mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
translate-all: notify plugin code of tb_flush
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 <alex.bennee@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
parent
235537fa73
commit
5025bb7fde
1 changed files with 6 additions and 0 deletions
|
@ -1231,6 +1231,8 @@ static gboolean tb_host_size_iter(gpointer key, gpointer value, gpointer data)
|
||||||
/* flush all the translation blocks */
|
/* flush all the translation blocks */
|
||||||
static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count)
|
static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count)
|
||||||
{
|
{
|
||||||
|
bool did_flush = false;
|
||||||
|
|
||||||
mmap_lock();
|
mmap_lock();
|
||||||
/* If it is already been done on request of another CPU,
|
/* If it is already been done on request of another CPU,
|
||||||
* just retry.
|
* 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) {
|
if (tb_ctx.tb_flush_count != tb_flush_count.host_int) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
did_flush = true;
|
||||||
|
|
||||||
if (DEBUG_TB_FLUSH_GATE) {
|
if (DEBUG_TB_FLUSH_GATE) {
|
||||||
size_t nb_tbs = tcg_nb_tbs();
|
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:
|
done:
|
||||||
mmap_unlock();
|
mmap_unlock();
|
||||||
|
if (did_flush) {
|
||||||
|
qemu_plugin_flush_cb();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tb_flush(CPUState *cpu)
|
void tb_flush(CPUState *cpu)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue