From nobody Thu Nov 6 10:34:18 2025 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.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 154027856165491.78459515271084; Tue, 23 Oct 2018 00:09:21 -0700 (PDT) Received: from localhost ([::1]:38476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEqoU-0002MB-8c for importer@patchew.org; Tue, 23 Oct 2018 03:09:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEqm3-0008RT-IS for qemu-devel@nongnu.org; Tue, 23 Oct 2018 03:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEqie-0003u4-7W for qemu-devel@nongnu.org; Tue, 23 Oct 2018 03:03:17 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36610) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gEqid-0003oD-OB for qemu-devel@nongnu.org; Tue, 23 Oct 2018 03:03:11 -0400 Received: by mail-wm1-x343.google.com with SMTP id a8-v6so547874wmf.1 for ; Tue, 23 Oct 2018 00:03:06 -0700 (PDT) Received: from cloudburst.twiddle.net.ASUS (host86-153-40-62.range86-153.btcentralplus.com. [86.153.40.62]) by smtp.gmail.com with ESMTPSA id t13-v6sm258355wrn.22.2018.10.23.00.03.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 00:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/KAHHOKz5/09uNy3szZc7ufuP1mXp9/ljoylRihFv20=; b=SbIop8mcTCRD74C0U7FihO3q0K8CreiBq2LSVGRRimB19I5ploZAWuQqQCahiPXFc2 wjypJKhDP0yHLFzMtwJMEJ3TihXFuUScA4/Z0y8jPqgdd1kNMH4aorBuOawNqQ2DQQz5 2ZlpSH8wSsM9U63k7CuB1LTpJAzPZOQqFVF6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/KAHHOKz5/09uNy3szZc7ufuP1mXp9/ljoylRihFv20=; b=qNCWxEarv56Mq21zAS+KKQL+Itfx8mDlPvCOX9UBoFy8vZjenfMHLxecTXHi9rHb1a s4pQNHJkxxtUCSblg+HlfrLh1zfZRZJzqB83/CeqqpWGJi8uaMTdGEzmtu8jro0NVHbf U+pLb1tiRCGQotIHzYIoB8N52uMdsLm6PU3xCJFZOz4u4IvTJRiveMhLbXdJuL2Mbwdt fwSqEFsbLafPU0YZmX7egboLvGqfZ6WHypp5BK+DzqzXx4JxcS1wHuRX8uKVFAMKioci RsbnvBptETS3KrJijMKuytCblmkC1wyufSxk9lSf/Mpy5T5ncM5GfWGXpYdi+xBFdaSe SXhA== X-Gm-Message-State: ABuFfojiTxr1MvxyqW6wfC6s603Z5KdE/N7Px0eyi8pOL4qz2IFPI8Cg IO/0OQCR79gUUu1OLrUee/0BMPMNky4= X-Google-Smtp-Source: ACcGV60VFObq0ZbE/kXpMRb2BpmmSKa+pZ39glcHUxFN4UKWa/94/tqVwvws/mK5XozEDwGcqVmfyQ== X-Received: by 2002:a1c:9ca:: with SMTP id 193-v6mr19663889wmj.86.1540278185608; Tue, 23 Oct 2018 00:03:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 23 Oct 2018 08:02:48 +0100 Message-Id: <20181023070253.6407-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181023070253.6407-1-richard.henderson@linaro.org> References: <20181023070253.6407-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH 05/10] cputlb: Move env->vtlb_index to env->tlb_d.vindex 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: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The rest of the tlb victim cache is per-tlb, the next use index should be as well. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/cpu-defs.h | 5 +++-- accel/tcg/cputlb.c | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index df8ae18d9d..181c0dbfa4 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -150,6 +150,8 @@ typedef struct CPUTLBDesc { */ target_ulong large_page_addr; target_ulong large_page_mask; + /* The next index to use in the tlb victim table. */ + size_t vindex; } CPUTLBDesc; =20 /* @@ -178,8 +180,7 @@ typedef struct CPUTLBCommon { CPUTLBEntry tlb_v_table[NB_MMU_MODES][CPU_VTLB_SIZE]; \ CPUIOTLBEntry iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; \ CPUIOTLBEntry iotlb_v[NB_MMU_MODES][CPU_VTLB_SIZE]; \ - size_t tlb_flush_count; \ - target_ulong vtlb_index; \ + size_t tlb_flush_count; =20 #else =20 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 72b0567f70..d3b37ffa85 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -119,6 +119,7 @@ static void tlb_flush_one_mmuidx_locked(CPUArchState *e= nv, int mmu_idx) memset(env->tlb_v_table[mmu_idx], -1, sizeof(env->tlb_v_table[0])); env->tlb_d[mmu_idx].large_page_addr =3D -1; env->tlb_d[mmu_idx].large_page_mask =3D -1; + env->tlb_d[mmu_idx].vindex =3D 0; } =20 /* This is OK because CPU architectures generally permit an @@ -149,8 +150,6 @@ static void tlb_flush_nocheck(CPUState *cpu) qemu_spin_unlock(&env->tlb_c.lock); =20 cpu_tb_jmp_cache_clear(cpu); - - env->vtlb_index =3D 0; } =20 static void tlb_flush_global_async_work(CPUState *cpu, run_on_cpu_data dat= a) @@ -668,7 +667,7 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulon= g vaddr, * different page; otherwise just overwrite the stale data. */ if (!tlb_hit_page_anyprot(te, vaddr_page)) { - unsigned vidx =3D env->vtlb_index++ % CPU_VTLB_SIZE; + unsigned vidx =3D env->tlb_d[mmu_idx].vindex++ % CPU_VTLB_SIZE; CPUTLBEntry *tv =3D &env->tlb_v_table[mmu_idx][vidx]; =20 /* Evict the old entry into the victim tlb. */ --=20 2.17.2