From patchwork Wed Dec 28 12:22:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 709219 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tpX3N1WRLz9sdn for ; Wed, 28 Dec 2016 23:24:12 +1100 (AEDT) Received: from localhost ([::1]:58808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMDH8-0004FB-10 for incoming@patchwork.ozlabs.org; Wed, 28 Dec 2016 07:24:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMDFi-0003Nf-Eb for qemu-devel@nongnu.org; Wed, 28 Dec 2016 07:22:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMDFe-00024G-0Z for qemu-devel@nongnu.org; Wed, 28 Dec 2016 07:22:42 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:48957 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMDFd-000230-Kj for qemu-devel@nongnu.org; Wed, 28 Dec 2016 07:22:37 -0500 Received: from gw-3.ac.upc.es (gw-3.ac.upc.es [147.83.30.9]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id uBSCMZjk005973; Wed, 28 Dec 2016 13:22:35 +0100 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id 2C704AA; Wed, 28 Dec 2016 13:22:35 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 28 Dec 2016 13:22:35 +0100 Message-Id: <148292775490.380.9265270336669001885.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 2.11.0 In-Reply-To: <148292774946.380.3638349228328753405.stgit@fimbulvetr.bsc.es> References: <148292774946.380.3638349228328753405.stgit@fimbulvetr.bsc.es> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id uBSCMZjk005973 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH v4 1/7] exec: [tcg] Refactor flush of per-CPU virtual TB cache X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Crosthwaite , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The function is reused in later patches. Signed-off-by: LluĂ­s Vilanova --- cputlb.c | 2 +- include/exec/exec-all.h | 6 ++++++ translate-all.c | 14 +++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cputlb.c b/cputlb.c index 813279f3bc..9bf9960e1b 100644 --- a/cputlb.c +++ b/cputlb.c @@ -80,7 +80,7 @@ void tlb_flush(CPUState *cpu, int flush_global) 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); env->vtlb_index = 0; env->tlb_flush_addr = -1; diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index a8c13cee66..57cd978578 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -256,6 +256,12 @@ struct TranslationBlock { }; 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); diff --git a/translate-all.c b/translate-all.c index 3dd9214904..29ccb9e546 100644 --- a/translate-all.c +++ b/translate-all.c @@ -941,11 +941,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) } CPU_FOREACH(cpu) { - int i; - - for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) { - atomic_set(&cpu->tb_jmp_cache[i], NULL); - } + tb_flush_jmp_cache_all(cpu); } tcg_ctx.tb_ctx.nb_tbs = 0; @@ -1741,6 +1737,14 @@ void tb_check_watchpoint(CPUState *cpu) } } +void tb_flush_jmp_cache_all(CPUState *cpu) +{ + int i; + for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) { + atomic_set(&cpu->tb_jmp_cache[i], NULL); + } +} + #ifndef CONFIG_USER_ONLY /* in deterministic execution mode, instructions doing device I/Os must be at the end of the TB */