From nobody Tue Nov 4 18:25:38 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530547847796962.3723445624961; Mon, 2 Jul 2018 09:10:47 -0700 (PDT) Received: from localhost ([::1]:34001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa1Pb-00082O-2q for importer@patchew.org; Mon, 02 Jul 2018 12:10:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa1Ku-0004eu-8P for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:05:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa1Kt-0005QP-Dj for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:05:56 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:37146) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fa1Kt-0005Pj-8J for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:05:55 -0400 Received: by mail-pg0-x242.google.com with SMTP id n15-v6so4107346pgv.4 for ; Mon, 02 Jul 2018 09:05:55 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id e17-v6sm38107002pfd.15.2018.07.02.09.05.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Jul 2018 09:05:52 -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=Za3snJKKi+Qz2FZHbHN1FIGuHvykZW/vRpgWAxCoJDI=; b=gX0te6voMZKYtOtnTunt1wAT2EwR6oqps3FnNr8qqS3ZOxl6fqBM/+DpbZ0E12bsk3 Bk8RM2T+ii1dQN/by82TFzp3c1KA6NgVsf2kJ+yHIDEgFphTuJaJAa/l3z16TYnUaM/D AU5gpfwomtWuBoOvZ2qNe8hk+0ZbAvCpZpsLs= 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=Za3snJKKi+Qz2FZHbHN1FIGuHvykZW/vRpgWAxCoJDI=; b=aQnPQzwprR9d5cNA51om+03agwnnQCtP8K1ygxJuCACppUU4j3A+HpisjUYBTrjbNk Is1jYJxarb2R/WyeKP/I2XAe8x8U2rYwIeDFgCULTcqhEQgnW8gxaPT9TmJfIfC7Q8Rd IaiY+CPPJvRT7qzmuBkhMNlU6goVZTnwK/UqenUSWPJO9XPSWsXLoeZ+RzpB/X8rNyIO 9o4Ec50VUpRBbn0NVfsGhL0AKnrBxCsDORTdEowC0u5QkxKGo9Bl+4a9VwFjodB+iQAs kMIlEjcyPaTjr8nojcaG5HVQ+FrD6TDUuFfCnsFCEZP9TEgoZVziDje4njHX4nKo3qsn 9O7A== X-Gm-Message-State: APt69E1NccDDj/MVNBVISYBdGRxSQcv5Lcb1/6a2JOmWij29zpbNv7Wz uanZRQwy57jOJ1YuHocLRmRjJVarrjo= X-Google-Smtp-Source: AAOMgpdLv9+rzbmR2owX4qsbITbfPOv7q2VblfKYV6aGStOfqzM4LzoTsT8sCE2/gYtd1KvsD1gy5Q== X-Received: by 2002:a62:6882:: with SMTP id d124-v6mr25951637pfc.122.1530547553723; Mon, 02 Jul 2018 09:05:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 2 Jul 2018 09:05:43 -0700 Message-Id: <20180702160546.31969-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180702160546.31969-1-richard.henderson@linaro.org> References: <20180702160546.31969-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PULL 3/6] accel/tcg: Correct "is this a TLB miss" check in get_page_addr_code() 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: peter.maydell@linaro.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: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell In commit 71b9a45330fe220d1 we changed the condition we use to determine whether we need to refill the TLB in get_page_addr_code() to if (unlikely(env->tlb_table[mmu_idx][index].addr_code !=3D (addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)))) { This isn't the right check (it will falsely fail if the input addr happens to have the low bit corresponding to TLB_INVALID_MASK set, for instance). Replace it with a use of the new tlb_hit() function, which is the correct test. Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell Message-Id: <20180629162122.19376-3-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index adb711963b..3ae1198c24 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -957,8 +957,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, ta= rget_ulong addr) =20 index =3D (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); mmu_idx =3D cpu_mmu_index(env, true); - if (unlikely(env->tlb_table[mmu_idx][index].addr_code !=3D - (addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)))) { + if (unlikely(!tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr))= ) { if (!VICTIM_TLB_HIT(addr_read, addr)) { tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0= ); } --=20 2.17.1