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 C4A21C4345F for ; Thu, 18 Apr 2024 22:12:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4EDE86B0095; Thu, 18 Apr 2024 18:12:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49D476B0096; Thu, 18 Apr 2024 18:12:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38BF66B0098; Thu, 18 Apr 2024 18:12:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1BE466B0095 for ; Thu, 18 Apr 2024 18:12:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CC2A9A1E2A for ; Thu, 18 Apr 2024 22:12:00 +0000 (UTC) X-FDA: 82024051200.15.FB1FAC3 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by imf18.hostedemail.com (Postfix) with ESMTP id DC2B81C0013 for ; Thu, 18 Apr 2024 22:11:58 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=dabbelt-com.20230601.gappssmtp.com header.s=20230601 header.b=1AJC41Xk; dmarc=none; spf=pass (imf18.hostedemail.com: domain of palmer@dabbelt.com designates 209.85.161.42 as permitted sender) smtp.mailfrom=palmer@dabbelt.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713478319; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=fJWNYLKtKkE3VgEEb7txo69kf/MROzgyItmd/8X/Bkw=; b=0AUJWoYaFoRIiHgVc6CYiPOfEZy8SAz6ThW8AukK+rjOOJTWEaeCSfYmrwfepztbckhKyW cnwPXQ0gePYCD5PDK1LrDdpXK6IgW1J1izH+Z3BtjnRYadnHvZhuyv6JddVpjsFxMxT6x9 cHAb5xi635BjUdAvt0GwFAT8tbUDrrs= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=dabbelt-com.20230601.gappssmtp.com header.s=20230601 header.b=1AJC41Xk; dmarc=none; spf=pass (imf18.hostedemail.com: domain of palmer@dabbelt.com designates 209.85.161.42 as permitted sender) smtp.mailfrom=palmer@dabbelt.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713478319; a=rsa-sha256; cv=none; b=mnTd9ww2KgCWLj/BNs9MTrOQrMTB5eKewK5cWddL1mL7+f3XbvVkwXlKa4ukcjufJarT+p JcG3Xyx4CppkGq6l+JC9uCVvErhsIpWq10yejaBoMNOTtUcKGbtTC2PI5uM3nnNFk9NpyK pXuzddJhcdFU3S2YF2xAZ8krqInCyb4= Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5aa2551d33dso828996eaf.0 for ; Thu, 18 Apr 2024 15:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20230601.gappssmtp.com; s=20230601; t=1713478318; x=1714083118; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=fJWNYLKtKkE3VgEEb7txo69kf/MROzgyItmd/8X/Bkw=; b=1AJC41Xk/ZNmFbr2TNBJbAUBYwHCs5aOs5Lb+M5GuPK62EAQJrcf0q1jSXVRb71Gjm NN9UeLDVxXy4cTFRfoYRO0+EECp//55SrdiOoqOBl0fWCKuCmT0s3TEgUga5NeWk358Y DJQntB+VVZGu8qZzitnDV55ZTdFT7GGbghDr5nr+YGi06JcLU45o0LHnKXP/3EKAptkM PucZ/nONed0dgP0rK/OYgNCO6Xw3WPqgRwP59I20ODPrL9BAr3G+QRxxOVygtcEJpRMc o04Sz7NiHtDCw/zD6ni4Dfcz6M3i6Ree6RcluoNjTvWRLCOdm6WbSFzPwS3uAK713ReD iVgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713478318; x=1714083118; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fJWNYLKtKkE3VgEEb7txo69kf/MROzgyItmd/8X/Bkw=; b=Bbn6pC/fedBTWQ6AcsNx7Zdo9VCGHp5DcNnVPP7MmZCb6vZ7x0bGHcEdBc3FN+DW3j BmFG6NSx0uT/EPH36vetcWjBC5E4mkFe2KUFcdSBUWMYPEnEh4KE3+M2hbn97ZLxNE24 ITJZyIon0681UBf11rnmuRxioG6MHqPElUcpiLpW7J357NE+E/zAQFP9So1QWfleyaBe iJvdIPnrj+bkVoHqT3txG7Kv0LCyEZzWqTiwrxJwTliaeRZZ1b7/nAaYVtejwuzxOKF5 n5CCRBD5ry1h72AFKBDuAp1J7vQ+f5ZtgcCvYmk5eTM4xxC8Y6LJYwILjdpEMvQrVgrY /0vw== X-Forwarded-Encrypted: i=1; AJvYcCWhMQADGv3K/IB+vlL/RKSzsWZSsbj3VF1nx8sD8xW0ZVZyCBkWbXx1N5rxTnjDzgsoMywtZ96Jywyus26J9AmWDVM= X-Gm-Message-State: AOJu0YyibM7ehoaGP77varz00aebGegICcS13+ZPOq/tsAicVuoWA1Ct SwH+z7IMI8Fbiz8Rp7fUK5L9gZKQ7yJPMPHLd57XcYcl+/ItYq3od0ixLQt+Qqo= X-Google-Smtp-Source: AGHT+IH5Rrf98QC4gFatEepR9aZzJYc9ESCNODVH0HHIz4PIvza73yv3y89sBwp3q1CAuQ8k41fxxw== X-Received: by 2002:a05:6870:d187:b0:232:ff53:44fe with SMTP id a7-20020a056870d18700b00232ff5344femr362648oac.38.1713478317422; Thu, 18 Apr 2024 15:11:57 -0700 (PDT) Received: from localhost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id q9-20020a63d609000000b005dc9439c56bsm1877624pgg.13.2024.04.18.15.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 15:11:56 -0700 (PDT) Date: Thu, 18 Apr 2024 15:11:56 -0700 (PDT) X-Google-Original-Date: Thu, 18 Apr 2024 15:11:55 PDT (-0700) Subject: Re: [PATCH 0/9] Merge arm64/riscv hugetlbfs contpte support In-Reply-To: CC: ryan.roberts@arm.com, Catalin Marinas , Will Deacon , Mark Rutland , Paul Walmsley , aou@eecs.berkeley.edu, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-mm@kvack.org From: Palmer Dabbelt To: alexghiti@rivosinc.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DC2B81C0013 X-Stat-Signature: 95qsbskphc4jy131r6rr5f5xemnjpsge X-HE-Tag: 1713478318-728474 X-HE-Meta: U2FsdGVkX19ZfHtA5cRbAYObkViBVGyYhefn7KKUa7tqjKaE+37bwd3tNjstjvyp02xFROlz+Y+cDRx3nCANMAuXjjmpWSKG6QE1KIXxgDtoEZK0UNv0t13KcCDhTU0orL5GIX2rEvjRn5Y1VJ0f3WHf9VNt7DpC8ygPeXKSSUMQJdSzhs9YnZwEHjF2Dj4AwO7cS61tg+oi9F7iV2uk2a4oEPQ5jJ4vZm8geKPP1IGMi3cClWmqJ8fJbMSPliDQWk0jl+TbZ3Xmx1JGlpGUh6LtafjH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dJLH685pyyPak9PvOjfWvUOIcVK/ENBXNuHZhlaYAosOIKUbvK49ZJqdcF1gniUrH8lDrb9L8zJ6+bKyMWoEgyFOG0DYUli2bZ+Eb4igXgtju2gesqvEx5DUS8DJZ/nmKVRHGXaesvgJgY8+iSiU/pF5qzNWtVMky4ekprDONlNkgydmmqS9Uqsf9Edp0lfCb13hobP4iO6j2IjbpygraCo3qIw+KSCRga+n7LmBx8d39GGMcPnWYmhznhEnjw== 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: On Fri, 01 Mar 2024 03:29:18 PST (-0800), alexghiti@rivosinc.com wrote: > Hi Ryan, > > On Fri, Mar 1, 2024 at 11:45 AM Ryan Roberts wrote: >> >> Hi Alexandre, >> >> I confess I haven't looked at the patches yet, but this cover letter raises a >> few quesions for me. I'll aim to look at the actual patches in due course. Acked-by: Palmer Dabbelt in case someone wants to pick them up via a generic tree. I'm happy to take them via the RISC-V tree if folk want, no rush on my end I'm just scrubbing through old stuff. >> On 01/03/2024 09:14, 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. >> >> Yes that makes sense to me. The intention for mTHP (!hugetlb) is to fully >> encapsulate PTEs beind set_ptes(), ptep_get() and friends, so what's actually >> written to the pgtable is arch-specific and well abstracted. >> >> > >> > 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. >> >> You seem to be talking about both hugetlb (which uses the "huge" pte helpers) >> and contpte for THP (i.e. mTHP, which uses the regular pte helpers). They are >> pretty separate in my mind, so not sure why you would be modifying them both in >> the same series? > > I don't, this patchset only deals with hugetlb, I just meant that this > series was just the beginning as I'm working on moving the contpte for > THP support in the generic code for riscv to use. > > Sorry my wording was ambiguous :) > > Thanks, > > Alex > >> >> Thanks, >> Ryan >> >> > >> > 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/ >> > >> > 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 | 59 +++++- >> > 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 | 120 +++++++++++- >> > arch/riscv/mm/hugetlbpage.c | 227 ---------------------- >> > mm/Kconfig | 3 + >> > mm/Makefile | 1 + >> > mm/contpte.c | 268 +++++++++++++++++++++++++ >> > 11 files changed, 456 insertions(+), 528 deletions(-) >> > create mode 100644 mm/contpte.c >> > >>