From patchwork Thu Jan 9 02:48:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182801 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp3413889och; Sun, 12 Jan 2020 10:06:38 -0800 (PST) X-Google-Smtp-Source: APXvYqza/t27KeKsE7N5NYKBo9HUk3uNFVtjB/ri4fl0xG/flNjd7GMB6HHBmy1x6VTiZ9gofljH X-Received: by 2002:a17:906:4ca:: with SMTP id g10mr9886236eja.354.1578845234337; Sun, 12 Jan 2020 08:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578845234; cv=none; d=google.com; s=arc-20160816; b=A/b66GzxLH93IFOFfxeKwQSJx9fuwEns1CtV092plSGuAH5JoHx46ptjKWHJzP7odx AoZISdTq1S+qxgeLLU1md5bwzs4nSswlSOBsLaLGT0S7ccW3VsWwW5SQAqrXJm2Zmqxw LFcXzx7GIEMqALKeOYvp+BFjZjVUv0rlCPabRT3gihk91L9co3E+qq1Dg9nv4/9Y51hj KP3iMN3HEOmPSxrtX9unchEooGpNUEaNGWMEgwE+iGdaVFutGk64Rw/FoynyHLy9z60Y uf0u5pZsh03eg5PbslaKkdx1HNIbiA5L48TvCtEAYegxsqlFUY65K4QV1Y1AdTU6+lIT UlSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lOjnREAHRE3NSpPGGVT2torwOdj/k63lQwetVtnWUzc=; b=yzZvhc2mVfSOp4ONoBq+g6oYxyD+kqfAza7pHTkGbMlYQIj/UFeC+4KD0yDoOF3+fU 8jQJmJiPSIj1ACIxSfHWs8KF9O0Z6qPz7yiCUNaeEtSmVdAYmAX6tqeDIMhZh26IQpcq 2+bCVIxqMfF/qhsgacnXziYWz15Z95UsAIjn+zZdR1pRHGIvxJd8oyvf+BegQphQQsea VpcGs7L5ZTq9LSyl1MvWxdchqMYNdVBFrCp8+q17txVV1W7+fcldSLWw9LfSFii+awZn KTJLgoyxfh8AJDHi07BZ/75sYG2mEEp90gBQK9JuPGNJ+wzj78JusqXpp2K2iwHIEaF9 Ieag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oRzVwyZ1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bo16si3708402edb.532.2020.01.12.08.07.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2020 08:07:14 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oRzVwyZ1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNvh-0006E7-Hk for patch@linaro.org; Wed, 08 Jan 2020 21:52:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51453) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNss-0002m5-Lo for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNsr-0005wc-6b for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:18 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:45146) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNsq-0005sx-T6 for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:17 -0500 Received: by mail-pg1-x543.google.com with SMTP id b9so2460128pgk.12 for ; Wed, 08 Jan 2020 18:49:16 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=lOjnREAHRE3NSpPGGVT2torwOdj/k63lQwetVtnWUzc=; b=oRzVwyZ1BFwOC6oV6r2a33BMgVDUrI+d71bbIGtIaj9tTyuJagJ7Xv42HYzxrst7eM 5VDh4g0Kwwxwn4U2nffJfA6idrrod4G64Bpg9TXxwKc1DGc3OZiWhnw40pAHstU9DKZC 93gmmSHTgPXY49yhiTgHE7EDlXYtRoN02qfkox6oblblXx87lF3rs7CiYqgYnjrpLq2y ipSkmNk+fRXdmVdF0kvcuV1uqwTrd3oC/RnPrZo4Q6lu8aXiMeenqpDOTUQhiOlQAmcM IxoWOS28FKf3th7U7fcmSLBlThlmxXWd7SCm5NzQQHXnwsS6hsdtACVlgT2JSEglwTlV msvQ== 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:mime-version:content-transfer-encoding; bh=lOjnREAHRE3NSpPGGVT2torwOdj/k63lQwetVtnWUzc=; b=qWimyTeLkccy2QprtxuMcYzS69CckFSnrTVllCeGnbSLGmy3myN/dCDaNs4tnL+p0h i1pTciK2sStq9QZSJJiIIBxd+TjqEHwraM7lV3+Ao4zmoFrb7Ih0Ia7hGHbqzspnHyGN sCqKigByqlr3TCU/BboPs1erHjVGTiISOZYSDKTAjMZFQgtho18PcYNzja+gdZX+l57f +vPVSB+RgpR4HViBt1u1GQjfsy3ZttqeaE81oZQb7H1w15CCQQyOFW6skUnaD3KhxfsI iiMduvzU2UbLoc9dCilEaEeNVOqYGe3NhUtUg6wU//bOXB7jOV6UVdMlZnld20mfhiRB FXSA== X-Gm-Message-State: APjAAAXCfE9cy+yusbJksAn2VUBH8VrSXGsS9V+RauHKxiVbdzk28m1H sw4GPXlJU7JfQROdOqoqoCfhzkrbOuzeDA== X-Received: by 2002:a62:b418:: with SMTP id h24mr9103623pfn.192.1578538155085; Wed, 08 Jan 2020 18:49:15 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id b4sm5337844pfd.18.2020.01.08.18.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:49:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/9] cputlb: Merge tlb_table_flush_by_mmuidx into tlb_flush_one_mmuidx_locked Date: Thu, 9 Jan 2020 13:48:59 +1100 Message-Id: <20200109024907.2730-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109024907.2730-1-richard.henderson@linaro.org> References: <20200109024907.2730-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There is only one caller for tlb_table_flush_by_mmuidx. Place the result at the earlier line number, due to an expected user in the near future. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) -- 2.20.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index a991ea2964..1a81886e58 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -224,11 +224,16 @@ static void tlb_mmu_resize_locked(CPUArchState *env, int mmu_idx) } } -static inline void tlb_table_flush_by_mmuidx(CPUArchState *env, int mmu_idx) +static void tlb_flush_one_mmuidx_locked(CPUArchState *env, int mmu_idx) { tlb_mmu_resize_locked(env, mmu_idx); - memset(env_tlb(env)->f[mmu_idx].table, -1, sizeof_tlb(env, mmu_idx)); env_tlb(env)->d[mmu_idx].n_used_entries = 0; + env_tlb(env)->d[mmu_idx].large_page_addr = -1; + env_tlb(env)->d[mmu_idx].large_page_mask = -1; + env_tlb(env)->d[mmu_idx].vindex = 0; + memset(env_tlb(env)->f[mmu_idx].table, -1, sizeof_tlb(env, mmu_idx)); + memset(env_tlb(env)->d[mmu_idx].vtable, -1, + sizeof(env_tlb(env)->d[0].vtable)); } static inline void tlb_n_used_entries_inc(CPUArchState *env, uintptr_t mmu_idx) @@ -289,16 +294,6 @@ void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide) *pelide = elide; } -static void tlb_flush_one_mmuidx_locked(CPUArchState *env, int mmu_idx) -{ - tlb_table_flush_by_mmuidx(env, mmu_idx); - env_tlb(env)->d[mmu_idx].large_page_addr = -1; - env_tlb(env)->d[mmu_idx].large_page_mask = -1; - env_tlb(env)->d[mmu_idx].vindex = 0; - memset(env_tlb(env)->d[mmu_idx].vtable, -1, - sizeof(env_tlb(env)->d[0].vtable)); -} - static void tlb_flush_by_mmuidx_async_work(CPUState *cpu, run_on_cpu_data data) { CPUArchState *env = cpu->env_ptr; From patchwork Thu Jan 9 02:49:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182753 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp3119511ile; Sun, 12 Jan 2020 08:03:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzDhp/ANA2KFjhQdcjfu8vjYbBfVot/2nwsO/OF9LgPBROk0mav5phWzPiohzJNWimy7/Ao X-Received: by 2002:a05:6402:64a:: with SMTP id u10mr13507171edx.147.1578844997980; Sun, 12 Jan 2020 08:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578844997; cv=none; d=google.com; s=arc-20160816; b=aYR2ksrZs4E6yaj+xvDASop46KW66T4Cdk9+nFODPmVa9xcHBAgvEMhYGYKbWrrfVm IhmsWAhSHTbOffxQ7aDR7zEgFGqIWDJ7ftD9qcB4iIkct4428Yui8hAOGHbIOadEq8/2 fzYNqAvbwMKmLQp3tGuy3zV7t1N3WDBR69gKT32/TX72jLVVmfTJ56H1c31LPSyuZ/m3 tjjVymUrMA44xXr58B5tKv0DUxnzQDZiaePigLv4jSe9zjCSRjSLKbgvcePl/eVQ/YGW //GwE8GbZ9L7g6Iyn2I/m0YGs3vijeSTwwN9NIRX7WztPvVS5+lWmEP8SzCyQ+qoeMVf 1PFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=oYo91seWJSqDhs3XCiSQHvutnJwwuv/GyZ2g9/2606w=; b=NKOPfdM0Ll9Xmn/e61aPzT9kIQBafoFdeW1pQDtSzd+jD9+HOhmCDPLoqBxuECx5gG cr5ddPXLQexv8Nz8EAoMCwu/rD7nr+h/9SONJ7HueLlTFaNbZjQn5LZGCvuuQ8acPEA5 StAjm6ObYZly/clrdZaN8548r2CKQl4bTDq4WAJZEp5xCrUGzK19NfRMqNS1EhSWJRN8 vIT0LH2ad3Mv/8AS+xBSbcwFatfDcKYYnEo2v6XfmFocW/afWLAYH6aKknWUWP+xIPDz oyK7QstiiiWKiXjoi2pc8Oo0T/nKysvNCuV7NJ2ae7FDsCL7v+fSWfUbrGkTmO0Mk9pG WoIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jqLvji6f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ba14si5282483edb.448.2020.01.12.08.03.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2020 08:03:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jqLvji6f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNvo-0006Mr-5l for patch@linaro.org; Wed, 08 Jan 2020 21:52:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51889) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNsv-0002mg-M1 for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNss-00061s-Sh for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:21 -0500 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:40718) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNss-0005zX-KJ for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:18 -0500 Received: by mail-pj1-x1043.google.com with SMTP id bg7so464912pjb.5 for ; Wed, 08 Jan 2020 18:49:18 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=oYo91seWJSqDhs3XCiSQHvutnJwwuv/GyZ2g9/2606w=; b=jqLvji6f8WTRRN7e7Bp3O7yyqgwDG4DaAmt5URX3fMbc0lIRWBRpZwcdbejZtPO+Ai 4BiflENdMsF+y6FYjL9kIz+UB6qpHVXzAJIOmRb2FF4AdYtLMZIYWytF12gR7OBw0UgG YfHlGO/N+1LjDd9xuYHo2EH+2k7LcjuZ3TBKSuaLt/5BK9hzNPt2icvx02QX0yCevxKA CT9xBScazARDa4b62CpfjrNepQDqikZLgwaU+z/SHyQd9EKhozRCrpjqa9O3x/rXFqgF h2wtJCSqNuH7TbeLCvD/oAPy0B5EMA7/NXYR/DkEPWrX9GR46GZc26/psKRyay5d/29W L0tg== 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:mime-version:content-transfer-encoding; bh=oYo91seWJSqDhs3XCiSQHvutnJwwuv/GyZ2g9/2606w=; b=VkX/7Vf05LW7BwGYqXe5XY9eytlwmfzIbD/ejaxqbUmCGC46Damy2TGAXDlHXjm/DE ciX4QsO+kH79B26eUuST+K5gODdleXq5vT90QuEaUzuoEJEK7WC2LAQKeOL+T05nGCLf 5Mwcn6EzEFWRmXFvMfCbaNdaX5BAOsirB1qNMdZhSS4y/dBQfzPPtpWLjRNg+9UgwCKj /LNtFroXuSQTffpYeEp6X1BeICGXyfcG8mbwjdLcteYxDPnONsLg/PObQgxGha65nALi 08WLE+kJIw3n80olgQlFIpBPRfco6rgxk1hDsuo6IzpTzcSHMif5c7kFKVE+degqJogj Rqiw== X-Gm-Message-State: APjAAAU0i3+jLKdkiZhlN2CkvZ5Z3eY0O7R/0rQroOcH0o0LTJyLC5eK bpHJEFR5jZewtxZzeScL2yNBk5orwM92uQ== X-Received: by 2002:a17:902:248:: with SMTP id 66mr9302085plc.158.1578538157239; Wed, 08 Jan 2020 18:49:17 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id b4sm5337844pfd.18.2020.01.08.18.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:49:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/9] cputlb: Make tlb_n_entries private to cputlb.c Date: Thu, 9 Jan 2020 13:49:00 +1100 Message-Id: <20200109024907.2730-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109024907.2730-1-richard.henderson@linaro.org> References: <20200109024907.2730-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1043 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There are no users of this function outside cputlb.c, and its interface will change in the next patch. Signed-off-by: Richard Henderson --- include/exec/cpu_ldst.h | 5 ----- accel/tcg/cputlb.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index a46116167c..53de19753a 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -234,11 +234,6 @@ static inline uintptr_t tlb_index(CPUArchState *env, uintptr_t mmu_idx, return (addr >> TARGET_PAGE_BITS) & size_mask; } -static inline size_t tlb_n_entries(CPUArchState *env, uintptr_t mmu_idx) -{ - return (env_tlb(env)->f[mmu_idx].mask >> CPU_TLB_ENTRY_BITS) + 1; -} - /* Find the TLB entry corresponding to the mmu_idx + address pair. */ static inline CPUTLBEntry *tlb_entry(CPUArchState *env, uintptr_t mmu_idx, target_ulong addr) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 1a81886e58..e4a8ed9534 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -80,6 +80,11 @@ QEMU_BUILD_BUG_ON(sizeof(target_ulong) > sizeof(run_on_cpu_data)); QEMU_BUILD_BUG_ON(NB_MMU_MODES > 16); #define ALL_MMUIDX_BITS ((1 << NB_MMU_MODES) - 1) +static inline size_t tlb_n_entries(CPUArchState *env, uintptr_t mmu_idx) +{ + return (env_tlb(env)->f[mmu_idx].mask >> CPU_TLB_ENTRY_BITS) + 1; +} + static inline size_t sizeof_tlb(CPUArchState *env, uintptr_t mmu_idx) { return env_tlb(env)->f[mmu_idx].mask + (1 << CPU_TLB_ENTRY_BITS); From patchwork Thu Jan 9 02:49:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182800 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp3219920ile; Sun, 12 Jan 2020 10:05:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwAgcjTJBXXx0s8VnP95DCbHWIjgX++tmDFpEMJg3TzPJ7ePwcCqfVIaxd64R48NW5Fda0G X-Received: by 2002:a05:620a:1327:: with SMTP id p7mr12508612qkj.148.1578845251670; Sun, 12 Jan 2020 08:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578845251; cv=none; d=google.com; s=arc-20160816; b=k3StqsHkuBWwKoiblUI3zih712FNkI+1a/jIBm5vfvHcSbuAjoCTSYgezYg8uM2tWV Ps4rrhVUJCskwhEv1Jl48O2aRY4aq2U4L0jZe4M+so3q/Ji1hEpXDHNvITHrtuxQA3wj HCnbpsXJeP/hUF367Kj9ZZAeYQ/tg6ZIRVcYQYC7PkiQa+bRQXFXz0tc4NtrJHpDQoKf nPiSfCkEtGHpq4dJQTguova5MlenQ9hWLS031hWru+WE8oEKuqTC/3it6MTQ1aRP7wWB Gyd9mXFqJJkvIrTOJelrTSB7DbIwXg0E30004jR0rpeo6J0OtFLER/yQs/kiGzk97Dr4 uLHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XkjF5TjcwaVUPhYaDrBfE80nKWVP4BhqQaLGCvT3zwQ=; b=NpipoBtXVrJkjXnpyqQWYLD3wmBaM7fyp/JxrNCN0qeHBisNSSp7JvBd4h7ws3K0bC p5VeVexpsQ7PN0XtHchvh7gosEKr1AoWqbiuoFKL9E587MPWQd4knaWO/zzfl3r8sceN pcM1AiGBYzjWgFRNWHwkkBjVJCRHDOYtwVRWUVsukZNOMCdgnP8XGWBAubUNimOsPMkb Uwfzm9j4QSadsFZKvs7xGqDrOi+TAzKDSr4xLXAxcK1tCXg/ugmrUGgZU00cN7tj0r8r +pSg8v3x1zHUZABYVokze4VKXH9PrbUbSvgqo/DIHw4cYUpzqDFTCc/+AZrFiyW1uOFu 3x0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lr7HWUM7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k20si4922320qkg.336.2020.01.12.08.07.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2020 08:07:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lr7HWUM7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNvs-0006V8-Sm for patch@linaro.org; Wed, 08 Jan 2020 21:52:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52013) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNsw-0002nj-Ed for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNsv-00067W-48 for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:22 -0500 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:44230) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNsu-00065Y-Q9 for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:20 -0500 Received: by mail-pf1-x441.google.com with SMTP id 195so2589679pfw.11 for ; Wed, 08 Jan 2020 18:49:20 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=XkjF5TjcwaVUPhYaDrBfE80nKWVP4BhqQaLGCvT3zwQ=; b=Lr7HWUM7VCKxiTjLgQgMwOiNBU0mgnsowMR2zMh+H28Vo5FlXbScP+sFveSBk/OqTl v5e8m7rHyVxTfLoINm6Sr/93fb4jQJMVoGLPXuu2QkTYN7q0IhDCZEP6uJ9JjGzcWivj fg2q+RcBTrHqXZ82otsfjgGcSVOg1me1oMIW5mMfQ8pPIJqOHaXoQcCTRBvkEOR+VCg3 IsRa+XHQ6wA+6r3NcKdnAbGrxgt5rCFysocPq95ynmWFrPm/7OoHgEMtfuTsNjS8be2m 0hhud7bEafAF1hI79Znes0HVC0POIrtPuDbZq9VGixq3BBMJsNFygEG1cT6NtYHsizfC I+2g== 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:mime-version:content-transfer-encoding; bh=XkjF5TjcwaVUPhYaDrBfE80nKWVP4BhqQaLGCvT3zwQ=; b=EY4R0kSZa9E9XDaZoDDcTc1/2kWOay4yK8+0FTPb3l6ixK5GwzsObqEuPW27YaijYg fOEuycchqom8NE+eB5BCrWc2ZFSxLfZcjL4B2lF0xNn+FBs0LFGvY/1SYREpoQK5wxdX zfS3enutD4ZTmd0MuyHXxmvdMoFNvfiNf0RTIEtKUUeYLZXOWbImPIhc8dc9njOAy7wv cyZNWD4nn8CqGLcQ5XQM5atO/4Smfplk18vi5HeSv6ip+pyKkFytnnPgjP+ys83NneFO J/MBB/5BtqwVJXqFJDqUpTN2SLvzcimsXTbaQe4aPBWSEVgWZ+7lxhOMPN4sOSf2m6Qu kYiQ== X-Gm-Message-State: APjAAAVTjUka/bzguuA/TDCCxTpHzIeyFPZxodbR2pBbaI/NSmsvalH7 IP0a3cShL0DPG8ygKO4912dINeAUj3LB1w== X-Received: by 2002:a65:680f:: with SMTP id l15mr9001671pgt.307.1578538159478; Wed, 08 Jan 2020 18:49:19 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id b4sm5337844pfd.18.2020.01.08.18.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:49:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/9] cputlb: Pass CPUTLBDescFast to tlb_n_entries and sizeof_tlb Date: Thu, 9 Jan 2020 13:49:01 +1100 Message-Id: <20200109024907.2730-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109024907.2730-1-richard.henderson@linaro.org> References: <20200109024907.2730-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We do not need the entire CPUArchState to compute these values. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index e4a8ed9534..49c605b6d8 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -80,14 +80,14 @@ QEMU_BUILD_BUG_ON(sizeof(target_ulong) > sizeof(run_on_cpu_data)); QEMU_BUILD_BUG_ON(NB_MMU_MODES > 16); #define ALL_MMUIDX_BITS ((1 << NB_MMU_MODES) - 1) -static inline size_t tlb_n_entries(CPUArchState *env, uintptr_t mmu_idx) +static inline size_t tlb_n_entries(CPUTLBDescFast *fast) { - return (env_tlb(env)->f[mmu_idx].mask >> CPU_TLB_ENTRY_BITS) + 1; + return (fast->mask >> CPU_TLB_ENTRY_BITS) + 1; } -static inline size_t sizeof_tlb(CPUArchState *env, uintptr_t mmu_idx) +static inline size_t sizeof_tlb(CPUTLBDescFast *fast) { - return env_tlb(env)->f[mmu_idx].mask + (1 << CPU_TLB_ENTRY_BITS); + return fast->mask + (1 << CPU_TLB_ENTRY_BITS); } static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns, @@ -156,7 +156,7 @@ static void tlb_dyn_init(CPUArchState *env) static void tlb_mmu_resize_locked(CPUArchState *env, int mmu_idx) { CPUTLBDesc *desc = &env_tlb(env)->d[mmu_idx]; - size_t old_size = tlb_n_entries(env, mmu_idx); + size_t old_size = tlb_n_entries(&env_tlb(env)->f[mmu_idx]); size_t rate; size_t new_size = old_size; int64_t now = get_clock_realtime(); @@ -236,7 +236,8 @@ static void tlb_flush_one_mmuidx_locked(CPUArchState *env, int mmu_idx) env_tlb(env)->d[mmu_idx].large_page_addr = -1; env_tlb(env)->d[mmu_idx].large_page_mask = -1; env_tlb(env)->d[mmu_idx].vindex = 0; - memset(env_tlb(env)->f[mmu_idx].table, -1, sizeof_tlb(env, mmu_idx)); + memset(env_tlb(env)->f[mmu_idx].table, -1, + sizeof_tlb(&env_tlb(env)->f[mmu_idx])); memset(env_tlb(env)->d[mmu_idx].vtable, -1, sizeof(env_tlb(env)->d[0].vtable)); } @@ -622,7 +623,7 @@ void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length) qemu_spin_lock(&env_tlb(env)->c.lock); for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { unsigned int i; - unsigned int n = tlb_n_entries(env, mmu_idx); + unsigned int n = tlb_n_entries(&env_tlb(env)->f[mmu_idx]); for (i = 0; i < n; i++) { tlb_reset_dirty_range_locked(&env_tlb(env)->f[mmu_idx].table[i], From patchwork Thu Jan 9 02:49:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182754 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp3119964ile; Sun, 12 Jan 2020 08:03:43 -0800 (PST) X-Google-Smtp-Source: APXvYqzuoQuSvR6Vz7HgQ2frQ69DArfzvn69y5pO+q3dO1HAxNMKnzCz6iwlRE0g93p1vG/obUSQ X-Received: by 2002:a17:906:19d8:: with SMTP id h24mr12467152ejd.166.1578845023450; Sun, 12 Jan 2020 08:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578845023; cv=none; d=google.com; s=arc-20160816; b=sRhtv010tXkZ0HcFYWGIbFn0DATd+5GYNHAF37r/8i7rWpUE85k/faItdIkdno4H7y JZaED28N7o4bCqILVY60wzWC+tP6IB7xakvRDQFTUqucoVh500hCpjIblNiDybBSXOZ4 8j4YMa75UGeq7GhkdkF16+5T+ELJ7v1ZVaqKLDE9pqTzw8oB+Yg7myYXzgOvVBh7Bfpl 5WBMwxog8Fe0w6WuAopFcGOr/s9J7kUWCiKfB0PsEmWIA6VjBMmypycc4AL9k7r/PgO2 mOF4LGXJHEXnDOyDr5JkJpds3CAYjpYLl1e+9taXVJnlyFSI8gbDUOgb5GSMv2L2sBgQ fgEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=taUAUKC6BKYXJEWWKuFwpPcKa1boShSWsRP/UsHn9jc=; b=ddAe4dVXrX4Wjfr1EdYWU2UticJT5hnrU3ZdCPxec4PMI3ZxLxDJ37tsYj7+QFMxxY 6t9bD4ohSmbsdNB4+8LlK4JNXUZMeEkRdynI3Q5VWJ6rg8FWNIL8vpVHGH1cuHvX0IHg vTcQ9AkhhkTqYw+Ryw9pqYGPxLYZsMdVujfoUF11s3o79cg7VeMuByhKFLffRiTi4ItX Q3olSiTL//qiDdpwlitDyqjKtnakzbCSMIwUisS5KbKVx2phmag/mdUP4KqvOo3TIOXr WSih4SUUhhQP+G4R+N7La2ML6NgO+0dQ7Ui66/Gleha/xysYQYnrWmdRMVBrkxVEO8LO YmGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NoY5F58w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k12si5091126ejx.78.2020.01.12.08.03.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2020 08:03:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NoY5F58w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipO0A-0005nv-97 for patch@linaro.org; Wed, 08 Jan 2020 21:56:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52872) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNt2-0002xu-Rn for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNsz-0006Ho-SA for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:28 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:38161) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNsz-0006GR-LI for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:25 -0500 Received: by mail-pl1-x644.google.com with SMTP id f20so1924747plj.5 for ; Wed, 08 Jan 2020 18:49:25 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=taUAUKC6BKYXJEWWKuFwpPcKa1boShSWsRP/UsHn9jc=; b=NoY5F58wu95p5ldgu3bNBAWK5JMbnfBU3g+F+E1zD/Q+rq0MYLKV7uOWPmxGEOkwZU PMXYV59UHLZMwm/2yRf/HvYnKLHDqeqzSWlKvm2LlknbhSbvCvJQ4ZSBZPNy9/AIUeAC 8RgCfFdDRmL/fCvQgf8allmpWdNqYNcO44rOGKuIM1S3SabFgZc2HpGo7LZIwWe+ay+R EbkHvLLKCt10jLb326PsJI8FP1MVEo/xZT8rLZuW4dNBNLsbNrMlJwaxMTAbOYGQ7MxK 1Sn5N2xDxoye/2QetoZVRKA+8SNqX9eA+u3oVy3xCD/ja6ABDKpDFWuUrexEjpxQeblj M9WQ== 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:mime-version:content-transfer-encoding; bh=taUAUKC6BKYXJEWWKuFwpPcKa1boShSWsRP/UsHn9jc=; b=DpWToTPPo38bTjvbE2ufh6ScwinEGEz+bHKBkSvQkOP1cQfVDn+h0nlvvNw/vX3tTb /FQkn2QPWSx5fIvHTBVpsk5W2rr6csmkSVH84f1MuvRVpP6NorrNOHT/5Gnx1PlfWuse /i7md5u92COCdyBC/TYawxUWmqSHAJy7Gz04bPDGosvZPW/QyiLDGjXZsshK+9/7w9RV rRcNtV9z1Y4pPjAFHYraT/Rg2k2gIzqvMIhDx5ASbQ5Jx8xqhleemylkX1UCzkYWTvHA 2gffHAaV3tGtFTGfo3s0O9CeC1xfpgTLyDiRJeYH2IniFTbtefHD3vgVbRSZ4Bwmsg8C 2urA== X-Gm-Message-State: APjAAAUcMC5EFo5XQTY4fMKHQf3QgQ1HO7ptvuyqLgMUoNkPvKT6Kviw O/r3wx4M+Q8pfugH7Ti07ewhT6I3XoI2cQ== X-Received: by 2002:a17:90a:b904:: with SMTP id p4mr2496940pjr.62.1578538164395; Wed, 08 Jan 2020 18:49:24 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id b4sm5337844pfd.18.2020.01.08.18.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:49:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 5/9] cputlb: Hoist tlb portions in tlb_flush_one_mmuidx_locked Date: Thu, 9 Jan 2020 13:49:03 +1100 Message-Id: <20200109024907.2730-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109024907.2730-1-richard.henderson@linaro.org> References: <20200109024907.2730-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" No functional change, but the smaller expressions make the code easier to read. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c7dc1dc85a..eff427f137 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -230,15 +230,16 @@ static void tlb_mmu_resize_locked(CPUTLBDesc *desc, CPUTLBDescFast *fast) static void tlb_flush_one_mmuidx_locked(CPUArchState *env, int mmu_idx) { - tlb_mmu_resize_locked(&env_tlb(env)->d[mmu_idx], &env_tlb(env)->f[mmu_idx]); - env_tlb(env)->d[mmu_idx].n_used_entries = 0; - env_tlb(env)->d[mmu_idx].large_page_addr = -1; - env_tlb(env)->d[mmu_idx].large_page_mask = -1; - env_tlb(env)->d[mmu_idx].vindex = 0; - memset(env_tlb(env)->f[mmu_idx].table, -1, - sizeof_tlb(&env_tlb(env)->f[mmu_idx])); - memset(env_tlb(env)->d[mmu_idx].vtable, -1, - sizeof(env_tlb(env)->d[0].vtable)); + CPUTLBDesc *desc = &env_tlb(env)->d[mmu_idx]; + CPUTLBDescFast *fast = &env_tlb(env)->f[mmu_idx]; + + tlb_mmu_resize_locked(desc, fast); + desc->n_used_entries = 0; + desc->large_page_addr = -1; + desc->large_page_mask = -1; + desc->vindex = 0; + memset(fast->table, -1, sizeof_tlb(fast)); + memset(desc->vtable, -1, sizeof(desc->vtable)); } static inline void tlb_n_used_entries_inc(CPUArchState *env, uintptr_t mmu_idx) From patchwork Thu Jan 9 02:49:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182770 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp3154650ile; Sun, 12 Jan 2020 08:43:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxcWUDgXJpLNj7pDvNeVzydbZQ8hHaQoimSJxW3oUcVWKGu+/mGZPcDeyh4Je4FVdXy/ZGD X-Received: by 2002:a50:ec1a:: with SMTP id g26mr13012275edr.164.1578845063133; Sun, 12 Jan 2020 08:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578845063; cv=none; d=google.com; s=arc-20160816; b=GgT3E7ohTw3RGxgM2EBBEBM9uFpKpxAdPWgimuR+1INCFLujoeBkuhu6GijdsG9LL5 9RYetLKOF77xXKLd2BTgBI1H/n747z5cB8Kk1WN6VXv/rsOPZHl70IwNTKpjpqjFJkC/ IGOMXzX8UgP5AxTmUerL6ZMpyJhJM1TD9uDodL998v4hgsNnScSI8ZCyFQ16MnknY79w /0dtYjsWVLAOMnw8iHQnVep4Xym4Hd/s1Nq5oJcSxqAV7IHzPlMaVPm0PqzfeaVQy4C+ FSw58YNDENDmHw6cmMFuhCpQKsIP7lXb7PbHArNeXbceFkiyh+jk/Stl7vFuMdOt9YsA z77A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bI837W0qu61ZCvf0+RXhi7DDjyBjyOrHLVOGWGh4Vsw=; b=GBpV2EMr8L1y2lPOX4vP3bwbRmOPXyyLoPMVhyaQwPTkQV6EfMXamFTw7GcjoybL8h F53Eom1sXmfRT03hpKHQmvuc0pwcSe37aZPTdxwvwhAjIS/tb1vNgtdAyfZk+8rlnNd7 CYGSPiqSWAzC/im+OLPVlypdLKN8JEhisqxzZhgWyAQH+Sg+7RUq5oejC8FgUBuNmvIW OJ1E90+hu8gqoOUziI3LgyKECskw+LGeHjodbomEPSPPFHqTIZkmgSpDJO7fYFfbA3b8 HAwoSOLyA7niAPjRND3mh6IYgmDAZIRi1FZ8tdzpzDJIjA/xTqJyluhw3RLmbn0JRiS6 Cy/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iIG46fRp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a3si5456399ejj.293.2020.01.12.08.04.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2020 08:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iIG46fRp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipO1l-0007FZ-Gv for patch@linaro.org; Wed, 08 Jan 2020 21:58:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53708) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNt9-00037M-0G for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNt6-0006UC-W8 for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:34 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:38160) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNt6-0006SQ-Nr for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:32 -0500 Received: by mail-pl1-x642.google.com with SMTP id f20so1924843plj.5 for ; Wed, 08 Jan 2020 18:49:32 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=bI837W0qu61ZCvf0+RXhi7DDjyBjyOrHLVOGWGh4Vsw=; b=iIG46fRp5ogMZwkYU6WuosNs1OINhSRHQhTCR9vDcxL+xBJXTkPoX+uyWMziexP0l4 9EkpqqqU69DPscWfYLa2EeeuVQMjftx6IVjmfiIIaW9aVfEooLfYU5li63N6zF1AsWIL 76liK7RFPBG2oRM1/Iu5i92JYpPTC8SrBziSQVt6mbAdpn8XQioo0goqdB2EDwfI26F/ GXeTsT9LmMT9Yi9b+gef/ohV19Yvl9qTKrhftH4d+UknHYFz63j+fTfQ44W8GE9a4Lfn 9znMOZZvpMb6vL42PonCvvdwu2W1X72yZvn6qMHZW0GZIs3GikgofENjztnlZTEdsjEy t6bQ== 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:mime-version:content-transfer-encoding; bh=bI837W0qu61ZCvf0+RXhi7DDjyBjyOrHLVOGWGh4Vsw=; b=MVlUNEB1kuprsPBb+uFhEf5uOLCe7Vs3dgXtDIkpB7OG2XCCjaDGEM7Ll0QSfER1y0 Nq/7AdQ/xrdrrXEAxLX0xiBoLcXItGe0jEFWK5YDubrds1CA98txJZQ3lw8j+IA+57o9 ivPZRk7b2PeIZs8ChamzoSKWj8chGsSiJ38or3nPfZ3LDB0i+V/ljDaUhYAE4dVzT7Sm AeUXUf3MieX5W0WZqDjyI4lLuCWK2IG48kFSOqMTEP4DUx5Vd2+ugDMK13cV5Xrlgb08 jy1c85/2RTQD+H4oKjg5WUSNmw9ZYZl1mzlNArQzRYr7v0sRp7h75sxAUbS1yLyJlK8J MLyg== X-Gm-Message-State: APjAAAXRAW7gcs3RIMaXrfXFlGYc35cA7AtWnOzklanF4qE4LTBm/toV B/6PMMTD466xku9erTUDe7ORESpgqSTqtA== X-Received: by 2002:a17:902:7792:: with SMTP id o18mr8409379pll.31.1578538171454; Wed, 08 Jan 2020 18:49:31 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id b4sm5337844pfd.18.2020.01.08.18.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:49:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 8/9] cputlb: Initialize tlbs as flushed Date: Thu, 9 Jan 2020 13:49:06 +1100 Message-Id: <20200109024907.2730-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109024907.2730-1-richard.henderson@linaro.org> References: <20200109024907.2730-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There's little point in leaving these data structures half initialized, and relying on a flush to be done during reset. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c7c34b185b..761e9d44d7 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -240,6 +240,7 @@ static void tlb_mmu_init(CPUTLBDesc *desc, CPUTLBDescFast *fast, int64_t now) fast->mask = (n_entries - 1) << CPU_TLB_ENTRY_BITS; fast->table = g_new(CPUTLBEntry, n_entries); desc->iotlb = g_new(CPUIOTLBEntry, n_entries); + tlb_mmu_flush_locked(desc, fast); } static inline void tlb_n_used_entries_inc(CPUArchState *env, uintptr_t mmu_idx) @@ -260,8 +261,8 @@ void tlb_init(CPUState *cpu) qemu_spin_init(&env_tlb(env)->c.lock); - /* Ensure that cpu_reset performs a full flush. */ - env_tlb(env)->c.dirty = ALL_MMUIDX_BITS; + /* All tlbs are initialized flushed. */ + env_tlb(env)->c.dirty = 0; for (i = 0; i < NB_MMU_MODES; i++) { tlb_mmu_init(&env_tlb(env)->d[i], &env_tlb(env)->f[i], now); From patchwork Thu Jan 9 02:49:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182757 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp3319146och; Sun, 12 Jan 2020 08:07:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzkHbcopU3bl/199rxQCXApWqsJiewJWk6XodPmUVCNKVh9Q5Jxk16lep7UcAwd+tZFoZIC X-Received: by 2002:a05:6402:12d2:: with SMTP id k18mr13057653edx.253.1578845024471; Sun, 12 Jan 2020 08:03:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578845024; cv=none; d=google.com; s=arc-20160816; b=0Wum1xwUWOuus0DJ9azT+MT1WlIdwRX8oKuk+r/8W9ms7XhjbZItY8S7MOtCZvNqiU wqUzy3bhzUancB1NJP/B1eUmJVtS0iQ/NiSub2o5quC7t+NNELxwkZ39OZghaKICoe2c 52tEMxsMdPuPOgINtrkC//qZT9RwLSqdxJ6/yqEWr4zLnbgOW18fpeKh1Lb9CJxWW0bP hBbC34t/UP26Cua+JmFCv8rqBQXAzaJEAJdzcn1Ol89zvvgFf6szC1RAKG0bSbN/Rt3U 2ioQeWPvO2GI70SC15I7faXY/ovuZnRNXc0nN1sfNjS3uRSJ8+tRNiEIGPPypvPVNXpJ CCgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7oSKIrC5QlsP+UfXWHE34ZSkgxpGtuY2yzIIDI3pxVg=; b=QaJnluYUcfi+SU8Yl0/VbTvzBT6eTcDGgC+3ktphFi36+gZsLKNSu3bwEMaQPS7mPt rIZhH1V170+yPzoPjZdHkHhpz5lrwmWCB7uRekwvLkRH0EGRW5Gcx/9vGIYAvgcRx6hr hiYjHkzFw5w77mTxQpmKyTUswj77xQ8rSLfg+BatO/CuLvLDP/v+jyi51FmWDLschoMN MsalnVV2EaKlxywjkHB5Hl6Yos6KLBBHcUPdFU5Of5FMU9E0HeyCB/IFdMlncF/Q8aK3 fO0yOeC66x9zkL0b+QyPht7R97Hi/GZO+XFZ6yyA7X/1Jui2QrU6v5guBeCFefkPebXR BZ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lOyB9FK9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y21si4210265eje.473.2020.01.12.08.03.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2020 08:03:44 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lOyB9FK9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipO0A-0005oU-P2 for patch@linaro.org; Wed, 08 Jan 2020 21:56:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54010) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNtB-0003Bi-6P for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNt9-0006aC-DX for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:36 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:35631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNt9-0006Xc-3X for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:35 -0500 Received: by mail-pf1-x444.google.com with SMTP id i23so2618404pfo.2 for ; Wed, 08 Jan 2020 18:49:35 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=7oSKIrC5QlsP+UfXWHE34ZSkgxpGtuY2yzIIDI3pxVg=; b=lOyB9FK9E2skyDHYPmTW/uGY8BzETIK6d+v7I7syXPz7KdzDUd4OgXo2UA1OMycb8G S7duWDwInokskO2azizjWsi9ui/BjBnqSmqyMwMugbNIhrxeGfUZUZNszB+j/BNCwwmP 5YO56UtDNSIKD0mVEoRCOZf/JUWA3UHhkk9DYF4W9dRuSTy7xNA/urIn3WxzsGL2PAjO itTGFacu4PLcGnMPDWrmmiPAuFrMhLhn2q8YW0y5vh+1wxkPQXQzfFzlS3v9RQY5MJQD EYjkI1Mo87RgKjFpal4l0BeXDdTt0BhxRUYi+aj6aDKKgkifBPVuDcCHPEI7Wxvqjn3G /uzA== 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:mime-version:content-transfer-encoding; bh=7oSKIrC5QlsP+UfXWHE34ZSkgxpGtuY2yzIIDI3pxVg=; b=h8jH9Yh4aoHNnKyv0hvjMocfDw+NDuYY7kq9XlxoNzNL/jVYmasAb45frlSxm6HNf2 ybeJZ+9aQYm2Tr/lcQ670qZJpqcjCZcp2mjTA5JTDWo1WeQZ03AYaTaS+CexU3ooaPdm TWL7fkrrFyMRD8DzEgJ0001ii4XSqVZlIcLpvoTnj00oOB1lVQ8rE0/UcDlBcMrDeSnB EHCwsJxORqelpWe8Nf2RNIH4zQrwayMjMuCN1F7AGoN7oaKAirOgt/3YJxJVXPqUCmqX XNL24XU1OTPLoANvUXBF8poJlw9NaGCdJiD0ame0MpyZWFioxuauBe5w3XiMpSJI1MZQ lxzA== X-Gm-Message-State: APjAAAWp1whNkRvW8/I/NuLwbLaRXv1Pj+q3ZeaU6W0am1v/YUt//CPV n/k/DkJWcZDMBdUoj/uGgbouRV+1ClgFhQ== X-Received: by 2002:a63:534d:: with SMTP id t13mr8329975pgl.89.1578538173727; Wed, 08 Jan 2020 18:49:33 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id b4sm5337844pfd.18.2020.01.08.18.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:49:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 9/9] cputlb: Hoist timestamp outside of loops over tlbs Date: Thu, 9 Jan 2020 13:49:07 +1100 Message-Id: <20200109024907.2730-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109024907.2730-1-richard.henderson@linaro.org> References: <20200109024907.2730-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Do not call get_clock_realtime() in tlb_mmu_resize_locked, but hoist outside of any loop over a set of tlbs. This is only two (indirect) callers, tlb_flush_by_mmuidx_async_work and tlb_flush_page_locked, so not onerous. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 761e9d44d7..9f6cb36921 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -137,12 +137,12 @@ static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns, * high), since otherwise we are likely to have a significant amount of * conflict misses. */ -static void tlb_mmu_resize_locked(CPUTLBDesc *desc, CPUTLBDescFast *fast) +static void tlb_mmu_resize_locked(CPUTLBDesc *desc, CPUTLBDescFast *fast, + int64_t now) { size_t old_size = tlb_n_entries(fast); size_t rate; size_t new_size = old_size; - int64_t now = get_clock_realtime(); int64_t window_len_ms = 100; int64_t window_len_ns = window_len_ms * 1000 * 1000; bool window_expired = now > desc->window_begin_ns + window_len_ns; @@ -222,12 +222,13 @@ static void tlb_mmu_flush_locked(CPUTLBDesc *desc, CPUTLBDescFast *fast) memset(desc->vtable, -1, sizeof(desc->vtable)); } -static void tlb_flush_one_mmuidx_locked(CPUArchState *env, int mmu_idx) +static void tlb_flush_one_mmuidx_locked(CPUArchState *env, int mmu_idx, + int64_t now) { CPUTLBDesc *desc = &env_tlb(env)->d[mmu_idx]; CPUTLBDescFast *fast = &env_tlb(env)->f[mmu_idx]; - tlb_mmu_resize_locked(desc, fast); + tlb_mmu_resize_locked(desc, fast, now); tlb_mmu_flush_locked(desc, fast); } @@ -310,6 +311,7 @@ static void tlb_flush_by_mmuidx_async_work(CPUState *cpu, run_on_cpu_data data) CPUArchState *env = cpu->env_ptr; uint16_t asked = data.host_int; uint16_t all_dirty, work, to_clean; + int64_t now = get_clock_realtime(); assert_cpu_is_self(cpu); @@ -324,7 +326,7 @@ static void tlb_flush_by_mmuidx_async_work(CPUState *cpu, run_on_cpu_data data) for (work = to_clean; work != 0; work &= work - 1) { int mmu_idx = ctz32(work); - tlb_flush_one_mmuidx_locked(env, mmu_idx); + tlb_flush_one_mmuidx_locked(env, mmu_idx, now); } qemu_spin_unlock(&env_tlb(env)->c.lock); @@ -446,7 +448,7 @@ static void tlb_flush_page_locked(CPUArchState *env, int midx, tlb_debug("forcing full flush midx %d (" TARGET_FMT_lx "/" TARGET_FMT_lx ")\n", midx, lp_addr, lp_mask); - tlb_flush_one_mmuidx_locked(env, midx); + tlb_flush_one_mmuidx_locked(env, midx, get_clock_realtime()); } else { if (tlb_flush_entry_locked(tlb_entry(env, midx, page), page)) { tlb_n_used_entries_dec(env, midx);