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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10807CD4F43 for ; Fri, 22 Sep 2023 09:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233017AbjIVJiF (ORCPT ); Fri, 22 Sep 2023 05:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231503AbjIVJiE (ORCPT ); Fri, 22 Sep 2023 05:38:04 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71EA318F; Fri, 22 Sep 2023 02:37:58 -0700 (PDT) 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 E8769DA7; Fri, 22 Sep 2023 02:38:34 -0700 (PDT) Received: from [10.57.65.11] (unknown [10.57.65.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A97B3F5A1; Fri, 22 Sep 2023 02:37:53 -0700 (PDT) Message-ID: <806eceac-8f97-403d-bee7-4fbc9e75e872@arm.com> Date: Fri, 22 Sep 2023 10:37:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 2/8] powerpc: hugetlb: Convert set_huge_pte_at() to take vma Content-Language: en-GB To: Christophe Leroy , Catalin Marinas , Will Deacon , "James E.J. Bottomley" , Helge Deller , Nicholas Piggin , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Gerald Schaefer , "David S. Miller" , Arnd Bergmann , Mike Kravetz , Muchun Song , SeongJae Park , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Anshuman Khandual , Peter Xu , Axel Rasmussen , Qi Zheng Cc: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-mm@kvack.org" , "stable@vger.kernel.org" References: <20230921162007.1630149-1-ryan.roberts@arm.com> <20230921162007.1630149-3-ryan.roberts@arm.com> <0f2dd31a-a361-24ba-154d-4e614c0eff73@csgroup.eu> <597e7496-ef99-4505-88ee-91701af02835@arm.com> <5ee382da-0ed0-9fb1-7640-35ef77c195fc@csgroup.eu> <871d277e-6c4e-418a-9574-2e9117646ca2@arm.com> <1cc4d995-efeb-9d15-446f-475e63154a2d@csgroup.eu> From: Ryan Roberts In-Reply-To: <1cc4d995-efeb-9d15-446f-475e63154a2d@csgroup.eu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On 22/09/2023 10:14, Christophe Leroy wrote: > > > Le 22/09/2023 à 10:41, Ryan Roberts a écrit : >> On 22/09/2023 09:10, Christophe Leroy wrote: >>> >>> >>>> I'm happy to take your proposed approach if that's your preference. Another >>>> option is to use a dummy VMA, as I have done in the core code, for the one call >>>> site that calls set_huge_pte_at() with init_mm: >>>> >>>> struct vm_area_struct vma = TLB_FLUSH_VMA(&init_mm, 0); >>>> >>>> This is an existing macro that creates a dummy vma with vma->vm_mm filled in. >>>> Then I pass &vma to the function. >>> >>> I don't like that, I prefer the solution I proposed. We already have a >>> couple places where powerpc do things based on whether vma is NULL or not. >>> >>>> >>>> Or yet another option would be to keep the mm param as is in set_huge_pte_at(), >>>> and add a size param to the function. But then all call sites have the burden of >>>> figuring out the size of the huge pte (although I think most know already). >>> >>> Indeed. >>> >>> arch_make_huge_pte() used to take a vma until commit 79c1c594f49a >>> ("mm/hugetlb: change parameters of arch_make_huge_pte()"). >>> >>> Should we try and have the same approach ? Or is it irrelevant ? >> >> See [1]; I'm going to rework to pass mm + size parameter since the current >> approach will break riscv. > > Can you pass a shift parameter instead of a size, like > arch_make_huge_pte() ? As far as I remember it is easier to handle a > shift than a size. Most of the call sites already have the size, not the shift. And arm64 needs the size, so it would have do (1UL << shift). So on that basis, I prefer to pass size. huge_pte_clear() already passes long unsigned sz, so I'd rather follow that pattern. > > Christophe