From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkHeT-0002ER-61 for qemu-devel@nongnu.org; Wed, 14 Sep 2016 17:23:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkHeP-0008Lk-4j for qemu-devel@nongnu.org; Wed, 14 Sep 2016 17:23:29 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:51957 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkHeO-0008Ka-OU for qemu-devel@nongnu.org; Wed, 14 Sep 2016 17:23:25 -0400 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Wed, 14 Sep 2016 23:23:22 +0200 Message-Id: <147388820263.17002.15629920094257482337.stgit@fimbulvetr.bsc.es> In-Reply-To: <147388819720.17002.17020698136656908126.stgit@fimbulvetr.bsc.es> References: <147388819720.17002.17020698136656908126.stgit@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 1/4] 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: Eric Blake , Eduardo Habkost , Stefan Hajnoczi , Paolo Bonzini , Peter Crosthwaite , 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 | 9 +++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cputlb.c b/cputlb.c index d068ee5..686a09c 100644 --- a/cputlb.c +++ b/cputlb.c @@ -81,7 +81,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 d008296..e2124dc 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -265,6 +265,12 @@ struct TranslationBlock { }; =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 0dd6466..ebd9fa0 100644 --- a/translate-all.c +++ b/translate-all.c @@ -851,8 +851,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)); - cpu->tb_flushed =3D true; + tb_flush_jmp_cache_all(cpu); } =20 qht_reset_size(&tcg_ctx.tb_ctx.htable, CODE_GEN_HTABLE_SIZE); @@ -1579,6 +1578,12 @@ 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)); + cpu->tb_flushed =3D true; +} + #ifndef CONFIG_USER_ONLY /* in deterministic execution mode, instructions doing device I/Os must be at the end of the TB */