From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56950C48BDF for ; Thu, 24 Jun 2021 08:29:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D729660725 for ; Thu, 24 Jun 2021 08:29:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D729660725 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 852778D0001; Thu, 24 Jun 2021 04:29:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 802FA6B0071; Thu, 24 Jun 2021 04:29:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67BC78D0001; Thu, 24 Jun 2021 04:29:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 33B846B0036 for ; Thu, 24 Jun 2021 04:29:22 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 464A68249980 for ; Thu, 24 Jun 2021 08:29:22 +0000 (UTC) X-FDA: 78287942964.24.AE2D5EB Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP id EDDC8E000113 for ; Thu, 24 Jun 2021 08:29:21 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id BCBD9613FE; Thu, 24 Jun 2021 08:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624523361; bh=n3+DR4PNcPYqodN80wD10aoRGrdopEbb0CZAydTJS6I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GhCuIF8SdQXKtGcQFyVKTQQvSkJyQi9K1zNRkqZIHg4UwcQZtgUAAh+edYMVuULI6 bxQ3Sodekl6HeI89qyqMxH9NFYfVnqq2JlDk+iuGJNvL59/zOPP9GWpAlU7PBWbqXm 1bTznd7jv6/ldLkNpoOK5ZPxRkZsc/3nDk6Rm3IfBlk5rXsnBEPgnxxO3okcWVaI+J jPD3vnQp5tqchLbeg+qv/Lx8YPIaamn2OdsuKU4ur/5wrjXf+obTpttl8+bpmTGXrh LBe7erXtMqDhmlmtp1Y0ojqc/jKIN/YTUomM2h6Cq6hwK0bpYQEP6oQuYrh0ctzE5M B2JD/TYmRG1fw== Date: Thu, 24 Jun 2021 09:29:15 +0100 From: Will Deacon To: Zhenyu Ye Cc: Catalin Marinas , aneesh.kumar@linux.ibm.com, Marc Zyngier , steven.price@arm.com, Peter Zijlstra , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Xiexiangyou , liushixin2@huawei.com, huyaqin , zhurui3@huawei.com Subject: Re: [PATCH v1] arm64: tlb: fix the TTL value of tlb_get_level Message-ID: <20210624082914.GA1194@willie-the-truck> References: <20210623110412.GA32177@willie-the-truck> <800c06ad-1491-c5ba-c650-c78384bf50c9@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <800c06ad-1491-c5ba-c650-c78384bf50c9@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GhCuIF8S; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of will@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=will@kernel.org X-Stat-Signature: pa4uywybjgeisyakttz1b4whdp6736f1 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EDDC8E000113 X-HE-Tag: 1624523361-815808 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jun 24, 2021 at 09:55:53AM +0800, Zhenyu Ye wrote: > On 2021/6/23 19:04, Will Deacon wrote: > > On Wed, Jun 23, 2021 at 03:05:22PM +0800, Zhenyu Ye wrote: > >> diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h > >> index 61c97d3b58c7..c995d1f4594f 100644 > >> --- a/arch/arm64/include/asm/tlb.h > >> +++ b/arch/arm64/include/asm/tlb.h > >> @@ -28,6 +28,10 @@ static void tlb_flush(struct mmu_gather *tlb); > >> */ > >> static inline int tlb_get_level(struct mmu_gather *tlb) > >> { > >> + /* The TTL field is only valid for the leaf entry. */ > >> + if (tlb->freed_tables) > >> + return 0; > >> + > >> if (tlb->cleared_ptes && !(tlb->cleared_pmds || > >> tlb->cleared_puds || > >> tlb->cleared_p4ds)) > > > > Thanks. I can't see a better way around this, so I'll queue the patch. > > The stage-2 page-table code looks ok afaict, but please can you check it > > too? > > The stage-2 page-table codes seem to be correct to me. Thanks for having a look. Will