From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK7OE-00080P-Gv for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:38:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK7OB-0004RE-QS for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:38:18 -0500 Received: from roura.ac.upc.es ([147.83.33.10]:58099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK7OB-0004R5-Fs for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:38:15 -0500 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Fri, 15 Jan 2016 17:38:14 +0100 Message-Id: <145287589397.11400.2479212855054723287.stgit@localhost> In-Reply-To: <145287587081.11400.4178335509020334684.stgit@localhost> References: <145287587081.11400.4178335509020334684.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v4 4/9] exec: [tcg] Refactor flush of per-CPU virtual TB cache List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Peter Crosthwaite , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson The function is reused in later patches. Signed-off-by: Llu=C3=ADs Vilanova --- cputlb.c | 2 +- include/exec/exec-all.h | 6 ++++++ translate-all.c | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cputlb.c b/cputlb.c index bf1d50a..74bf989 100644 --- a/cputlb.c +++ b/cputlb.c @@ -61,7 +61,7 @@ void tlb_flush(CPUState *cpu, int flush_global) =20 memset(env->tlb_table, -1, sizeof(env->tlb_table)); memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table)); - memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); + tb_flush_jmp_cache_all(cpu); =20 env->vtlb_index =3D 0; env->tlb_flush_addr =3D -1; diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index d900b0d..0859873 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -238,6 +238,12 @@ struct TBContext { }; =20 void tb_free(TranslationBlock *tb); +/** + * tb_flush_jmp_cache_all: + * + * Flush the virtual translation block cache. + */ +void tb_flush_jmp_cache_all(CPUState *env); void tb_flush(CPUState *cpu); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); =20 diff --git a/translate-all.c b/translate-all.c index 042a857..56899ee 100644 --- a/translate-all.c +++ b/translate-all.c @@ -846,7 +846,7 @@ void tb_flush(CPUState *cpu) tcg_ctx.tb_ctx.nb_tbs =3D 0; =20 CPU_FOREACH(cpu) { - memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); + tb_flush_jmp_cache_all(cpu); } =20 memset(tcg_ctx.tb_ctx.tb_phys_hash, 0, sizeof(tcg_ctx.tb_ctx.tb_phys= _hash)); @@ -1586,6 +1586,11 @@ void tb_check_watchpoint(CPUState *cpu) } } =20 +void tb_flush_jmp_cache_all(CPUState *cpu) +{ + memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); +} + #ifndef CONFIG_USER_ONLY /* in deterministic execution mode, instructions doing device I/Os must be at the end of the TB */