Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp171732pxj; Wed, 23 Jun 2021 18:59:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOBMzggprv4NrlrHVh6uMLZ136cH6hqeUoT28sDgKxYM9WbdQsDYTUW5oTzSmTH440qXjt X-Received: by 2002:aa7:c256:: with SMTP id y22mr3612642edo.177.1624499982077; Wed, 23 Jun 2021 18:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624499982; cv=none; d=google.com; s=arc-20160816; b=BjYN37QoqJ9BbPnwQoug7pc9+Vhdr6JNqyNQOqAjgKgWYf9af4TR/aKldWfGI+WkM+ 12GVaXyq9abqbVDQFdcestzsMufQsUoAjIrmrftxuqMHhwQd9+25MYa5M9btuBLz1bIK SToih0IfD24EdwuKfrOE8gPx92KExHo46bUUGC1krhncPmlenEHFBkwKbOKbEaYZ8WgC bgD+Y9m7ThYDXcZswR1WNbMwkpURUhN2DBoiuTfGBpvOGK/CtTSnDIOBesiNw0dZMKy1 Dd6P8obnNmvcMx2VLuld0lEZzRXBQTkIxg9I9zXHwp0e307iAv4JUgBPtENlBRjFAIOn Krzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=ft1/iGIfywYpvqDfznW4jejOVOfTodskgp+89qeMvgo=; b=VMjei8Nu9Nu/+B9u9klxgVJVI/41jLOh5Jt5rd/9ueZiz7bZPB/HugsyOhmdDnZmUF FkDzp3yDJ363JIyHNCjGGEXXXLyWehSivwNmyJABfAjIVmu4Rt2UVYChJBjnAtHO4pih xP6dMSO9zIMFfBnBC/iS07OWGF5QYNZLMZbKv5yEhQ6nNNlL949jwlr7CA8uVI0JyGiN FdgPHo4mdPJz12hAeh8NyxVPg2MsbOoI8h+lHoAlnCxNRXOSd+a1L1vccrqHqkwDSxvf 04kcItdrZRFIqgyoULEEBYVBZjci3ci3LsKZ5ZYxlMgElQyY4MNBFY+swcIIb8GJJ4w/ 9t8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si1499570eds.538.2021.06.23.18.59.00; Wed, 23 Jun 2021 18:59:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbhFXB62 (ORCPT + 99 others); Wed, 23 Jun 2021 21:58:28 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:8314 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbhFXB61 (ORCPT ); Wed, 23 Jun 2021 21:58:27 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4G9NRM1yJXz71yJ; Thu, 24 Jun 2021 09:51:59 +0800 (CST) Received: from dggpemm500017.china.huawei.com (7.185.36.178) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 24 Jun 2021 09:56:06 +0800 Received: from [10.174.186.21] (10.174.186.21) by dggpemm500017.china.huawei.com (7.185.36.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 24 Jun 2021 09:56:05 +0800 Subject: Re: [PATCH v1] arm64: tlb: fix the TTL value of tlb_get_level To: Will Deacon CC: Catalin Marinas , , Marc Zyngier , , Peter Zijlstra , , , , , Xiexiangyou , , huyaqin , References: <20210623110412.GA32177@willie-the-truck> From: Zhenyu Ye Message-ID: <800c06ad-1491-c5ba-c650-c78384bf50c9@huawei.com> Date: Thu, 24 Jun 2021 09:55:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20210623110412.GA32177@willie-the-truck> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.186.21] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500017.china.huawei.com (7.185.36.178) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, Zhenyu