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 7EB00C04FFE for ; Wed, 8 May 2024 11:32:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 03EDA6B0148; Wed, 8 May 2024 07:32:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F30CA6B0149; Wed, 8 May 2024 07:32:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1F4A6B014A; Wed, 8 May 2024 07:32:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C46566B0148 for ; Wed, 8 May 2024 07:32:11 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 43D991C14FF for ; Wed, 8 May 2024 11:32:11 +0000 (UTC) X-FDA: 82095014862.22.BA3F0F9 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by imf21.hostedemail.com (Postfix) with ESMTP id 1AF301C0004 for ; Wed, 8 May 2024 11:32:08 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf21.hostedemail.com: domain of alex@ghiti.fr designates 217.70.183.200 as permitted sender) smtp.mailfrom=alex@ghiti.fr ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715167929; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mKFnCSBAMEgtINABAqhAX/lYC1PlZ7YUkyYdY+Imoyg=; b=QdGmw+mqpVicubiNAH0JJPagW3vWi7kTxkJhNR+W/88eqLmNSA5lcxIqwCjun/WhVxfcz+ BackAp7/5IJzjq39tK0RE/qomLiWdN8M8Y3wdOdUQk0FgSz7M0Bgk9BV6U3eIC0AxiKYL+ ad631ZYsLHRkqf0j6SeY2aw4qwmGDQs= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf21.hostedemail.com: domain of alex@ghiti.fr designates 217.70.183.200 as permitted sender) smtp.mailfrom=alex@ghiti.fr ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715167929; a=rsa-sha256; cv=none; b=vrgUU0YTP5MF3jHUVfQhiKFjjBZrCrrmNOZuLIavydEkOPa8cMCGpbYx7dNLfrRJ3NBEZF vEgKxeRhit+vxAYyFt4X0pdbm3iK28acrlD8lYmb8mohVhX2Tjjq2SjkvkAUj3nvWNXSS+ cZ+apYwWCHJJsNvi1hVaOZtHYAAvdzY= Received: by mail.gandi.net (Postfix) with ESMTPSA id 9CB8920009; Wed, 8 May 2024 11:32:05 +0000 (UTC) Message-ID: Date: Wed, 8 May 2024 13:32:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/9] Merge arm64/riscv hugetlbfs contpte support Content-Language: en-US To: Alexandre Ghiti , Catalin Marinas , Will Deacon , Ryan Roberts , Mark Rutland , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-mm@kvack.org References: <20240508111829.16891-1-alexghiti@rivosinc.com> From: Alexandre Ghiti In-Reply-To: <20240508111829.16891-1-alexghiti@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Spam-Score: 400 X-GND-Status: SPAM X-GND-Sasl: alex@ghiti.fr X-Stat-Signature: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RxxyXhw 2oE55dak 8vS9y9ukjOVAYlnLTlF31z0lAQIy3d//+UnjCh5qVwyHK2FcXtT6KQ9k1DvEMwAzL3QLpDKgEfH+F8WeqC1quVuXtgelysqoqlJBT0gw6X90Y4tTJjLIbkNS1uROx7JagRlRhlNGQIn7mpfSD97tOLnFw1s8l3TFQkFb5QFBVs8MFFDkRGOW+iwxKt1vJxG8HrQLzYH0h+fnpERiQvSPVb8pDE21ZuIoqljwHbImJkxQ4dN4= 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: List-Subscribe: List-Unsubscribe: I should not have unplugged this outlet...Sorry, ignore this series, I'm sending a RESEND right away. On 08/05/2024 13:18, Alexandre Ghiti wrote: > This patchset intends to merge the contiguous ptes hugetlbfs implementation > of arm64 and riscv. > > Both arm64 and riscv support the use of contiguous ptes to map pages that > are larger than the default page table size, respectively called contpte > and svnapot. > > The riscv implementation differs from the arm64's in that the LSBs of the > pfn of a svnapot pte are used to store the size of the mapping, allowing > for future sizes to be added (for now only 64KB is supported). That's an > issue for the core mm code which expects to find the *real* pfn a pte points > to. Patch 1 fixes that by always returning svnapot ptes with the real pfn > and restores the size of the mapping when it is written to a page table. > > The following patches are just merges of the 2 different implementations > that currently exist in arm64 and riscv which are very similar. It paves > the way to the reuse of the recent contpte THP work by Ryan [1] to avoid > reimplementing the same in riscv. > > This patchset was tested by running the libhugetlbfs testsuite with 64KB > and 2MB pages on both architectures (on a 4KB base page size arm64 kernel). > > [1] https://lore.kernel.org/linux-arm-kernel/20240215103205.2607016-1-ryan.roberts@arm.com/ > > Changes in v2: > - Rebase on top of 6.9-rc3 > > Alexandre Ghiti (9): > riscv: Restore the pfn in a NAPOT pte when manipulated by core mm code > riscv: Safely remove huge_pte_offset() when manipulating NAPOT ptes > mm: Use common huge_ptep_get() function for riscv/arm64 > mm: Use common set_huge_pte_at() function for riscv/arm64 > mm: Use common huge_pte_clear() function for riscv/arm64 > mm: Use common huge_ptep_get_and_clear() function for riscv/arm64 > mm: Use common huge_ptep_set_access_flags() function for riscv/arm64 > mm: Use common huge_ptep_set_wrprotect() function for riscv/arm64 > mm: Use common huge_ptep_clear_flush() function for riscv/arm64 > > arch/arm64/Kconfig | 1 + > arch/arm64/include/asm/pgtable.h | 56 +++++- > arch/arm64/mm/hugetlbpage.c | 291 +--------------------------- > arch/riscv/Kconfig | 1 + > arch/riscv/include/asm/hugetlb.h | 2 +- > arch/riscv/include/asm/pgtable-64.h | 11 ++ > arch/riscv/include/asm/pgtable.h | 153 +++++++++++++-- > arch/riscv/mm/hugetlbpage.c | 227 ---------------------- > arch/riscv/mm/pgtable.c | 6 +- > mm/Kconfig | 3 + > mm/Makefile | 1 + > mm/contpte.c | 272 ++++++++++++++++++++++++++ > 12 files changed, 480 insertions(+), 544 deletions(-) > create mode 100644 mm/contpte.c >