From patchwork Fri Jan 15 16:38:14 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: 8043221 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 95FEA9F6FA for ; Fri, 15 Jan 2016 16:39:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03D1F20426 for ; Fri, 15 Jan 2016 16:39:58 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 4ADCF203F4 for ; Fri, 15 Jan 2016 16:39:57 +0000 (UTC) Received: from localhost ([::1]:47975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK7Po-0002Iw-MF for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jan 2016 11:39:56 -0500 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 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 u0FEweJI029633; Fri, 15 Jan 2016 15:58:40 +0100 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id 8096F9B9; Fri, 15 Jan 2016 17:38:14 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Fri, 15 Jan 2016 17:38:14 +0100 Message-Id: <145287589397.11400.2479212855054723287.stgit@localhost> X-Mailer: git-send-email 2.6.4 In-Reply-To: <145287587081.11400.4178335509020334684.stgit@localhost> References: <145287587081.11400.4178335509020334684.stgit@localhost> 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 u0FEweJI029633 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Cc: Eduardo Habkost , Peter Crosthwaite , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson Subject: [Qemu-devel] [PATCH v4 4/9] exec: [tcg] Refactor flush of per-CPU virtual TB cache X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 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) 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 d900b0d..0859873 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -238,6 +238,12 @@ struct TBContext { }; 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 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 = 0; CPU_FOREACH(cpu) { - memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); + tb_flush_jmp_cache_all(cpu); } 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) } } +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 */