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 7A027C3ABC3 for ; Fri, 9 May 2025 13:02:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF5E5280035; Fri, 9 May 2025 09:02:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA4D5280031; Fri, 9 May 2025 09:02:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6CA7280035; Fri, 9 May 2025 09:02:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B6C68280031 for ; Fri, 9 May 2025 09:02:10 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7A3811C81EF for ; Fri, 9 May 2025 13:02:10 +0000 (UTC) X-FDA: 83423382420.13.151A749 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 8BAC44000E for ; Fri, 9 May 2025 13:02:08 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746795728; 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:references; bh=ktkld80348pq4diiaBsonNNJGXZYtqDampHum037LXc=; b=8UPbbpRRZJii+xH4BUe6ycGEnbpWc8A3omOnxbmfi+qoNMpP0iFInj1e2iSdfkToKVTLuV 5dKjzHucFsr2AKVlyDngvMoPsuK/MGjBNF8E3XoqGSh66URRdTF7+LKqMZAuyL3eaBz9Hv 95kAeS4ZLNDYs5JnCxvzZX6WohtHEq8= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746795728; a=rsa-sha256; cv=none; b=Ptj/S+6jFPIN/6TBil4PEmbVexzH5QBLztfPSQEY1qpRwF4X2fSdWW32Sr1xKcGKekcN4Y JBEe3nmeAQZuZOwz/nQ7QiHqZft83oNQTbL/+3B0alUmFPYiMqIe7EcWDTMRzwfWwxk8BC iVqpCjHItUdbZVrWdd0hez9lreGLScg= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B18BA1595; Fri, 9 May 2025 06:01:56 -0700 (PDT) Received: from [10.57.90.222] (unknown [10.57.90.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 87F603F58B; Fri, 9 May 2025 06:02:05 -0700 (PDT) Message-ID: <2ad910f4-6930-4da2-aa2b-f3875f71e001@arm.com> Date: Fri, 9 May 2025 14:02:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 0/9] Merge arm64/riscv hugetlbfs contpte support Content-Language: en-GB To: Alexandre Ghiti , Will Deacon , Lorenzo Stoakes Cc: Alexandre Ghiti , Catalin Marinas , Mark Rutland , Matthew Wilcox , Paul Walmsley , Palmer Dabbelt , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-mm@kvack.org References: <20250321130635.227011-1-alexghiti@rivosinc.com> <4dd5d187-f977-4f27-9937-8608991797b5@ghiti.fr> <64409a13-1c07-42cd-b1ec-572042738f1b@arm.com> <84cb893a-46e3-408a-ba0e-2eff0b44d2a1@ghiti.fr> <20250508123046.GA3706@willie-the-truck> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Stat-Signature: 9mtx9trt94d7m5wyyjso9a3ckwrd16a9 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8BAC44000E X-Rspam-User: X-HE-Tag: 1746795728-60484 X-HE-Meta: U2FsdGVkX1+O+qAX3Rdaq75ooCQmukUqhY3/TsMubyTdmBl79G9tjKF7bP9bClBqlcOrEh48WkIxCbLU871JsUwY/TETbQWuvazsGG+Sv6PNAlu6KEHBNjLYjgscDj6iHHbGxRfsFs4jIS0xTET1d+j4URkvz6vtBqaNUhf86dY4iPX5ooxIi4nYyzbO6foZsI6fsneDFyUEZhVolcRTfUUsYxtsSu9VFNbFlamBCtUmw6tKWnY7LLUtcOm01Hln7eMbj4LbtR7I6aNQp0AwXqFRUdrEripuHZVOIVhb7aGhq2pOU+zgNJ41s18AKzskNAtKeezUp5dmA2tCRfncPHmY/MVOFx5AaysYp3r9SnFSQTWQOwbsCk+didFDRyDZodaxfxpuxpw1vkN+QDPlTBc/l4wAZKiIoZ0+edZSTa8ti2/eNVz9TW5hprVSxtTqoCDsJ7W4dWERc6ah9y/NT/Rh1b7nx2aW4wFBOv4vv0FG0NtcZWOBdO9FkjT2qHe4zJ5YvUJCoePbvkhFiEJ9LLGS1tJdQi7ystdY41T6l7Yc1Xhi2RJIKblv0hruo5NkY4bbYhtaHpcO7AsE3aeRsHkLQsWQSP9KDC4R7GRNNeNbziUns4l1pswioHcp+++LnM/GcvA9Vq5NQtOD5afu0dhlqjAouCj+Ea5MJtmkvDESKSSTRQvfilcxZVfz3ranZ71h4azMuv/Phf4JesXbzO00tRCuza5djN+hF7ICJOxLiVJF7MEATWbR7zjCekVsRg5ydpLLCkhMfPZhEjfRsacr3phUgB44qD5n209JhaJ/LoEXD57dDUczzI7+KGZbiabXC5EZ1s0H18SyiNKVP5jnUEcJdMHr 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 09/05/2025 12:09, Alexandre Ghiti wrote: > Hi Will, > > On Thu, May 8, 2025 at 2:30 PM Will Deacon wrote: >> >> Hi folks, >> >> On Mon, May 05, 2025 at 06:08:50PM +0200, Alexandre Ghiti wrote: >>> On 29/04/2025 16:09, Ryan Roberts wrote: >>>> On 07/04/2025 13:04, Alexandre Ghiti wrote: >>>>> Can someone from arm64 review this? I think it's preferable to share the same >>>>> implementation between riscv and arm64. >>>> I've been thinking about this for a while and had some conversations internally. >>>> This patchset has both pros and cons. >>>> >>>> In the pros column, it increases code reuse in an area that has had quite of few >>>> bugs popping up lately; so this would bring more eyes and hopefully higher >>>> quality in the long run. >>>> >>>> But in the cons column, we have seen HW errata in similar areas in the past and >>>> I'm nervous that by hoisting this code to mm, we make it harder to workaround >>>> any future errata. Additionally I can imagine that this change could make it >>>> harder to support future Arm architecture enhancements. >>>> >>>> I appreciate the cons are not strong *technical* arguments but nevertheless they >>>> are winning out in this case; My opinion is that we should keep the arm64 >>>> implementations of huge_pte_ (and contpte_ too - I know you have a separate >>>> series for this) private to arm64. >>>> >>>> Sorry about that. >>>> >>>>> The end goal is the support of mTHP using svnapot on riscv, which we want soon, >>>>> so if that patchset does not gain any traction, I'll just copy/paste the arm64 >>>>> implementation into riscv. >>>> This copy/paste approach would be my preference. >>> >>> >>> I have to admit that I disagree with this approach, the riscv and arm64 >>> implementations are *exactly* the same so it sounds weird to duplicate code, >>> the pros you mention outweigh the cons. >>> >>> Unless I'm missing something about the erratas? To me, that's easily fixed >>> by providing arch specific overrides no? Can you describe what sort of >>> erratas would not fit then? One concrete feature is the use of Arm's FEAT_BBM level 2 to avoid having to do break-before-make and TLB maintenance when doing a fold or unfold operation. There is a series in flight to add this support at [1]. I can see this type of approach being extended to the hugetlb helpers in future. I also have another series in flight at [2] that tidies up the hugetlb implementation and does some optimizations. But the optimizations depend on arm64-specific TLB maintenance APIs. [1] https://lore.kernel.org/linux-arm-kernel/20250428153514.55772-2-miko.lenczewski@arm.com/ [2] https://lore.kernel.org/linux-arm-kernel/20250422081822.1836315-1-ryan.roberts@arm.com/ As for errata, that's obviously much more fuzzy; there have been a bunch relating to the MMU in the recent past, and I wouldn't be shocked if more turned up. For future architecture enchancements, I'm aware of one potential feature being discussed for which this change would likely make it harder to implement. >> >> If we start with the common implementation you have here, nothing >> prevents us from forking the code in future if the architectures diverge >> so I'd be inclined to merge this series and see how we get on. OK if that's your preference, I'm ok with it. I don't have strong opinion, just a sense that we will end up with loads of arch-specific overrides. As you say, let's see. Alexandre, I guess this series is quite old now and will need to incorporate the hugtelb fixes I did last cycle? And ideally I'd like [2] to land then for that to also be incorporated into your next version. (I'm still hopeful we can get [2] into v6.16 and have been waiting patiently for Will to pick it up ;) ). I guess we can worry about [1] later as that is only affected by your other series. How does that sound? >> However, >> one thing I *do* think we need to ensure is that the relevant folks from >> both arm64 (i.e. Ryan) and riscv (i.e. Alexandre) are cc'd on changes to >> the common code. Otherwise, it's going to be a step backwards in terms >> of maintainability. >>>> Could we add something to MAINTAINERS so that the new file picks you both >> up as reviewers? That's fine with me. Lorenzo added me for some parts of MM this cycle anyway. Thanks, Ryan > > I'm adding Lorenzo as he is cleaning the mm MAINTAINERS entries. > > @Lorenzo: should we add a new section "CONTPTE" for this? FYI, hugetlb > is the first patchset, I have another patchset to merge THP contpte > support [1] as well so the "HUGETLB" section does not seem to be a > good fit. > > [1] https://lore.kernel.org/linux-riscv/20240508191931.46060-1-alexghiti@rivosinc.com/ > > Thanks, > > Alex > >> >> Will