From patchwork Mon Jul 2 16:05:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140825 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp129446ljj; Mon, 2 Jul 2018 09:11:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+9ZcgwOn0fsOEeso6wqCYpaNl8OOJUhvzj5+oIixH99tXlqKcUEmWiRqsn0ehoGsLMnA4 X-Received: by 2002:a37:67d5:: with SMTP id b204-v6mr21518416qkc.108.1530547880191; Mon, 02 Jul 2018 09:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530547880; cv=none; d=google.com; s=arc-20160816; b=SjWnsubp7L9A7MUglnAFjhiXBlhSvrPYtyss2fhZ+sdSB1BLrg/7bpkZqoqg6WcTQH f6YbpPvf0UFgsyPRtLbPuqxeeLqI+ib8TUldQ061aPGv39vkh1QSdx6UBE89lisXzqSj wiWqB7U/FAWBBLr2dLFlUB6cREQX8u9bhB/+p6aRURWiNmOJjlrbHlBFAlE5mrBvwu0m 77f3ObXy8aBpNTcgMkO2yr2K5aToKg1oPcyyI+N4klkfA6OL7aXN0axCao5ojKJtLi/e qNNztGfKaukAgDR0fEYMQ2xuyz6srQ5MmXRjP9m11izq6b9RNnMLd5mlGj2U3Bqj44Bq kXXg== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Za3snJKKi+Qz2FZHbHN1FIGuHvykZW/vRpgWAxCoJDI=; b=J5nSHJcL+CGiPRghjyxr5JnZXPcCS/PlTNFkVs/6IZiUeHAWL/vsG/MZ1QORt1OQ0B pYPeNQZg4NQXfGhdJdf5WnFX6bQOjwrIFLILEtWmQNwZkcMzHWI+/ClUoKrOrlkU13mb Xe7K4m5Iu8KRJ4fOUTNkl4zqaBW1rBTg0F4CGOYHm9OFbu3wHH9riWIZ81cO4DvxevRU zNfGQlDk8wPdzGLsjeF7o4M2Wp0XddSnW0Tnuo/4QXYQxvKZOQvDxKXhEjYNoFeWK8zQ jNPMDeK2JEbFoOYvmFSSnRR5B5LbvDIkdVKd1xN6SpBArAJs6Szl3Q5aazNoRF6rnUqC 6fvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gX0te6vo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g3-v6si4485447qve.248.2018.07.02.09.11.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Jul 2018 09:11:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gX0te6vo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa1Q7-00082O-LM for patch@linaro.org; Mon, 02 Jul 2018 12:11:19 -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) 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-Received: by 2002:a62:6882:: with SMTP id d124-v6mr25951637pfc.122.1530547553723; Mon, 02 Jul 2018 09:05:53 -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) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 != (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(-) -- 2.17.1 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, target_ulong addr) index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); mmu_idx = cpu_mmu_index(env, true); - if (unlikely(env->tlb_table[mmu_idx][index].addr_code != - (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); }