From patchwork Tue Jun 27 09:56:02 2017 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: 9811261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8691B60351 for ; Tue, 27 Jun 2017 09:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 797F7205D6 for ; Tue, 27 Jun 2017 09:57:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C7BC2851D; Tue, 27 Jun 2017 09:57:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E00BE205D6 for ; Tue, 27 Jun 2017 09:57:15 +0000 (UTC) Received: from localhost ([::1]:51501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPnFD-0000py-2D for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Jun 2017 05:57:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPnEK-0000me-Cs for qemu-devel@nongnu.org; Tue, 27 Jun 2017 05:56:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPnEC-0003gp-RH for qemu-devel@nongnu.org; Tue, 27 Jun 2017 05:56:15 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:55672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPnEC-0003gY-EL for qemu-devel@nongnu.org; Tue, 27 Jun 2017 05:56:12 -0400 Received: from correu-2.ac.upc.es (correu-2.ac.upc.es [147.83.30.92]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v5R9u8BB017691; Tue, 27 Jun 2017 11:56:08 +0200 Received: from localhost (unknown [132.68.53.125]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id 29CE61EA; Tue, 27 Jun 2017 11:56:03 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Tue, 27 Jun 2017 12:56:02 +0300 Message-Id: <149855736194.4578.18235949987662755688.stgit@frigg.lan> X-Mailer: git-send-email 2.11.0 In-Reply-To: <149855711979.4578.11884555663631849051.stgit@frigg.lan> References: <149855711979.4578.11884555663631849051.stgit@frigg.lan> 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 v5R9u8BB017691 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 v9 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 , "Emilio G. Cota" , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The function is reused in later patches. Signed-off-by: LluĂ­s Vilanova Reviewed-by: Richard Henderson --- accel/tcg/cputlb.c | 2 +- accel/tcg/translate-all.c | 15 ++++++++++----- include/exec/exec-all.h | 6 ++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 743776ae19..6a2b762325 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -118,7 +118,7 @@ static void tlb_flush_nocheck(CPUState *cpu) 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/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index f6ad46b613..03820e3aeb 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -928,11 +928,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; @@ -949,6 +945,15 @@ done: tb_unlock(); } +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); + } +} + void tb_flush(CPUState *cpu) { if (tcg_enabled()) { diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 724ec73dce..b0281b000f 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -366,6 +366,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); TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,