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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3838BC00528 for ; Mon, 31 Jul 2023 13:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Of7kElTjdYbrw60pOHi9AZOWf4hJUh28dknh1vyisNI=; b=kT8v+Uxd0NWWlB A7tc5wGuC1GbPaztkCmfTLQPqB5+3IH1lTv+PJsHRe/cgfdyjdHRxIMqgt8h7+nTaFSnXjfyWSG9x yAxyqiSi3pNxcrAPWZ4h1IEhpt2iQrH/mXNxsZ3o8gipMJbjlKEqJWIz2s/JGN/Jhmr2d6RSJs19D i659+QyTtYFmz6NC7XX9H+8GEi5Ige3Wooc3fvAbMXevixQ/eK8It1D7nGa3Hi+dkcHriOB1zPmjg YRrAfrDFzgyge2PCrQeEr8kqHja7OebLyD3ibf0QONIoKubKYm+Ex0/hKU3MNSwVQuwZ2uhco+V/C UmoNPcsozCuQHTYVNP8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQSn8-00Fn4t-32; Mon, 31 Jul 2023 13:18:30 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQSn6-00Fn45-2B for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2023 13:18:30 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 252FA61138; Mon, 31 Jul 2023 13:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7D57C433C8; Mon, 31 Jul 2023 13:18:18 +0000 (UTC) Date: Mon, 31 Jul 2023 14:18:12 +0100 From: Catalin Marinas To: Kefeng Wang Cc: Andrew Morton , Will Deacon , Mike Kravetz , Muchun Song , Mina Almasry , kirill@shutemov.name, joel@joelfernandes.org, william.kucharski@oracle.com, kaleshsingh@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] arm64: tlb: set huge page size to stride for hugepage Message-ID: References: <20230731074829.79309-1-wangkefeng.wang@huawei.com> <20230731074829.79309-5-wangkefeng.wang@huawei.com> <70e81ce8-a27a-325f-68d1-836532ed2ba0@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <70e81ce8-a27a-325f-68d1-836532ed2ba0@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_061828_753078_3FCF6802 X-CRM114-Status: GOOD ( 18.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 31, 2023 at 07:27:14PM +0800, Kefeng Wang wrote: > 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? Right. Only the pmd/pud cases. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42557C001DC for ; Mon, 31 Jul 2023 13:18:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E1AB6B00A7; Mon, 31 Jul 2023 09:18:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86A74280023; Mon, 31 Jul 2023 09:18:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70B966B00AA; Mon, 31 Jul 2023 09:18:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 58A026B00A7 for ; Mon, 31 Jul 2023 09:18:31 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 28B30160B41 for ; Mon, 31 Jul 2023 13:18:31 +0000 (UTC) X-FDA: 81071961222.04.AF9356A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 32AC9A0006 for ; Mon, 31 Jul 2023 13:18:28 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf15.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690809509; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xsPA6iTy+JJw12Fz4MBnlcETXUE2CsiLOVu0L+PoZ1U=; b=zfRvWxIoU4qNOKNHtCjWivjJ+Eqf6VoFkntmlhP429b3cJvVY7ct8PgD2GE6pb1l3H3+fQ 3S5AXQPXYVpCWWr8kkOtNsaWbj4dx8ajVyFUFgemOVONVgMWxvrZ1Y6skjXwFK9qOG52pG IkApYl2AsXjiC2XWMDjnqVExW4aUa58= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf15.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690809509; a=rsa-sha256; cv=none; b=YmA5GEaowsxMw0gAIUaXfJpNQdDjJ+mPxTjUojzRGUy55aQY8h0TPvULiFIi5E4OEqL3oS j9e3Qh9+jB20Yxd2N0vuu/FnsEx+Ld+I+LufwOsV1A5TjEfsuo+Ow7NI6u5WOZZun1FIts FTVl2jKMvkYM2UflNylkbE11sZ0CxB8= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 252FA61138; Mon, 31 Jul 2023 13:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7D57C433C8; Mon, 31 Jul 2023 13:18:18 +0000 (UTC) Date: Mon, 31 Jul 2023 14:18:12 +0100 From: Catalin Marinas To: Kefeng Wang Cc: Andrew Morton , Will Deacon , Mike Kravetz , Muchun Song , Mina Almasry , kirill@shutemov.name, joel@joelfernandes.org, william.kucharski@oracle.com, kaleshsingh@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] arm64: tlb: set huge page size to stride for hugepage Message-ID: References: <20230731074829.79309-1-wangkefeng.wang@huawei.com> <20230731074829.79309-5-wangkefeng.wang@huawei.com> <70e81ce8-a27a-325f-68d1-836532ed2ba0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70e81ce8-a27a-325f-68d1-836532ed2ba0@huawei.com> X-Rspamd-Queue-Id: 32AC9A0006 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: cdekzimshxzj3z8ff8iucijmzqgmdbmy X-HE-Tag: 1690809508-87767 X-HE-Meta: U2FsdGVkX1+ceOw+AOC820ZaN/l+wHIjvYBLULydesx+cDlDmmpFhFHBG4/XVxgT5A3xIGtytq428wmh0Zx/U/Ht2puncF14og7kWzc83jL6ThOoEr815ujuWVdqas2tRqC2RgmTmsyV/8cXR4VKlbM2u4GQEC4CevLS0h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UyBNdtYZafzAnI1cTvypBf+5LRqGlCNEAIa/CnArIJ76ONId7dZZdcfj7E/DlW95JEbzGbrYNgk7gepyBk1wABxXq+odZDMKIoRI8uSlbwLFsnlpslrPH6C3ax9WqrwhuAfmVqHXVb8p9JqrPw/6oKfsdhDL9NIPq2CWsp 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 Mon, Jul 31, 2023 at 07:27:14PM +0800, Kefeng Wang wrote: > 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? Right. Only the pmd/pud cases. -- Catalin