From nobody Mon Feb 9 20:12:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498738718685568.4751985863836; Thu, 29 Jun 2017 05:18:38 -0700 (PDT) Received: from localhost ([::1]:38928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQYP5-0000nw-19 for importer@patchew.org; Thu, 29 Jun 2017 08:18:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQYOH-0000VV-LC for qemu-devel@nongnu.org; Thu, 29 Jun 2017 08:17:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQYOE-00050y-Bh for qemu-devel@nongnu.org; Thu, 29 Jun 2017 08:17:45 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:34088 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQYOD-00050u-VS for qemu-devel@nongnu.org; Thu, 29 Jun 2017 08:17:42 -0400 Received: from correu-1.ac.upc.es (correu-1.ac.upc.es [147.83.30.91]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v5TCHd8h027663; Thu, 29 Jun 2017 14:17:39 +0200 Received: from localhost (unknown [132.68.50.243]) by correu-1.ac.upc.es (Postfix) with ESMTPSA id A10A81C4; Thu, 29 Jun 2017 14:17:33 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Thu, 29 Jun 2017 15:17:32 +0300 Message-Id: <149873865231.9180.13927490238451232263.stgit@frigg.lan> X-Mailer: git-send-email 2.11.0 In-Reply-To: <149873841036.9180.16600465902334229930.stgit@frigg.lan> References: <149873841036.9180.16600465902334229930.stgit@frigg.lan> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id v5TCHd8h027663 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 v10 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The function is reused in later patches. Signed-off-by: Llu=C3=ADs 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) =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/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) } =20 CPU_FOREACH(cpu) { - int i; - - for (i =3D 0; i < TB_JMP_CACHE_SIZE; ++i) { - atomic_set(&cpu->tb_jmp_cache[i], NULL); - } + tb_flush_jmp_cache_all(cpu); } =20 tcg_ctx.tb_ctx.nb_tbs =3D 0; @@ -949,6 +945,15 @@ done: tb_unlock(); } =20 +void tb_flush_jmp_cache_all(CPUState *cpu) +{ + int i; + + for (i =3D 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 { }; =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); TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,