qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 19/48] translate-all: notify plugin code of tb_flu


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC 19/48] translate-all: notify plugin code of tb_flush
Date: Fri, 23 Nov 2018 17:00:59 +0000
User-agent: mu4e 1.1.0; emacs 26.1.90

Emilio G. Cota <address@hidden> writes:

> 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 3423cf74db..1690e3fd5b 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -1233,6 +1233,8 @@ static gboolean tb_host_size_iter(gpointer key, 
> gpointer value, gpointer data)
>  /* flush all the translation blocks */
>  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.
> @@ -1240,6 +1242,7 @@ 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();
> @@ -1265,6 +1268,9 @@ void do_tb_flush(CPUState *cpu, run_on_cpu_data 
> tb_flush_count)
>
>  done:
>      mmap_unlock();
> +    if (did_flush) {
> +        qemu_plugin_flush_cb();
> +    }

Are we introducing a race here?

What is the purpose of letting the plugin know a flush has occurred?

It shouldn't have any knowledge of the details of liveliness of the
translated code and if it still exits or not. If all it wants to do is
look at the counts then I think we can provide a simpler less abuse-able
way to do this.

>  }
>
>  void tb_flush(CPUState *cpu)


--
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]