Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4313919rwb; Mon, 31 Jul 2023 05:13:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlE8o4FqQFojCG8VPf8MJu/z9X36jkpuP8xxuKS/OYZpKSvr0mOll2NaObiG7J9bmGmC59ee X-Received: by 2002:a17:906:30c5:b0:99b:c830:cf23 with SMTP id b5-20020a17090630c500b0099bc830cf23mr5800729ejb.27.1690805588668; Mon, 31 Jul 2023 05:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690805588; cv=none; d=google.com; s=arc-20160816; b=yKh4/+2eemdAm7b9aVtk6VQiyZcUnNspVJ2DWZUs34Es38UpWEQqRssGgSrinkpcTP xwIH+LKp4FFagfEmsMkplgSmNAkZx6CsGJ1qc/8rh4Gt1i1g6/hM78Iah7Q67l4ObE+M 8mzkWaVaylRdE+1fORTLV3UGtsK9ZwZsnuh6LEck5Gz/PksRXQc7pLBaauQTsKsFYEwU hrzwpIC+43k7i3mFTWrHaDsBEL1DT0jr9V/fmo5rY1Ac9y2oEVEeeL+XsHVMu7myQlOH fuiZ62aMcA2ZxULlH6qTXkPwE7JMjRysOYB/fWHT0gnFOo3kH6JKGKm4utdLocJFSZjt EDZA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=XORHYwMIFjShI5UKC/FJAJr8KBqC5P/ShUSvLr9VuCw=; fh=amSVZ4YoK7HXBc9Q1XvYUyvgb7dFTJAqNBT2/1r+8yQ=; b=N3rQWcC8G4JIg5rpyNxtOmSyg6k3I45YiDqLdK2sql3oE4iZZkGk8VlvKOzs7vY4VL No3CL/c+4QVtIhoXwmCWFA/VI8ckAV6Id1+Z5s7bw5ZXdeR/MUFAchs6kJfj4C4hYgoi B4+DJAlqUIi4UipvwsXC6Xn+fRXa85cRcKp9OF/tOpKCf6GTPzda2rAUV+/dSGSHirPp kl4i7pfk0olC7LhzO5GSPWD3Iz3r9tdYQxm903rlQoJWZMLTkZNDqLtAPPzrECL87bpP uLO7oTuDa5UoYp7sHLwOhF3V2L3uq8W2Z7RPOAZJW30oG8QeZrvsB5eQ0QbEj+gKwZQx 7UdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a17090652d800b0099845f657a8si2595363ejn.616.2023.07.31.05.12.42; Mon, 31 Jul 2023 05:13:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbjGaL1U (ORCPT + 99 others); Mon, 31 Jul 2023 07:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbjGaL1T (ORCPT ); Mon, 31 Jul 2023 07:27:19 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CB99C9 for ; Mon, 31 Jul 2023 04:27:18 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RDwsz6y5Lz1GDJw; Mon, 31 Jul 2023 19:26:15 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 31 Jul 2023 19:27:14 +0800 Message-ID: <70e81ce8-a27a-325f-68d1-836532ed2ba0@huawei.com> Date: Mon, 31 Jul 2023 19:27:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH 4/4] arm64: tlb: set huge page size to stride for hugepage Content-Language: en-US To: Catalin Marinas CC: Andrew Morton , Will Deacon , Mike Kravetz , Muchun Song , Mina Almasry , , , , , , , References: <20230731074829.79309-1-wangkefeng.wang@huawei.com> <20230731074829.79309-5-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/31 19:11, Catalin Marinas wrote: > On Mon, Jul 31, 2023 at 03:48:29PM +0800, Kefeng Wang wrote: >> +/* >> + * We cannot use leaf-only invalidation here, since we may be invalidating >> + * table entries as part of collapsing hugepages or moving page tables. >> + * Set the tlb_level to 0 because we can not get enough information here. >> + */ >> +#define flush_tlb_range(vma, start, end) \ >> + __flush_tlb_range(vma, start, end, \ >> + ((vma)->vm_flags & VM_HUGETLB) \ >> + ? huge_page_size(hstate_vma(vma)) \ >> + : PAGE_SIZE, false, 0) > > This won't work if we use the contiguous PTE to get 64K hugetlb pages on > a 4K base page configuration. The 16 base pages in the range would have > to be invalidated individually (the contig PTE bit is just a hint, the > hardware may or may not take it into account). Got it, the contig huge page is depended on hardware implementation, but for normal hugepage(2M/1G), we could use this, right? >