Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2578471rdb; Fri, 22 Sep 2023 02:51:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdM+0MrtPSbSwNsaoVntPb/59r+JRS+qd/rjY6tGWQbP8usfpEVioVharYgMw2xWIVbAyW X-Received: by 2002:a17:90b:3ec3:b0:274:da68:f296 with SMTP id rm3-20020a17090b3ec300b00274da68f296mr3119186pjb.17.1695376275745; Fri, 22 Sep 2023 02:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695376275; cv=none; d=google.com; s=arc-20160816; b=WI+ualtUJRtVouwWtn/n2HeCRNjfxzjr1dpZK1elmDEnWi/ND0XQhyqx5zl20h8Ntb ZjAynhPKQwRpShAWiU4BgBaAtm/4ZB/uVOpWshUP8w7aTkd6lbxf0B5UyPjPbiCQ6uKY mQAImJMGBwfrpCpjT7yQibQkc8iCkmNNo8CKesE/6ZR+TEdlk5x3eHB4J8aLvsbM480Z bA3L1oIXBdy8pBBLV1iEHYJ2gdRyV6JyqodfThxLEVgyYhm/rweOmXi1Mp6n4uJNSOyA IfVg6yL4lHXptG3zReN0LQvksMUJyUnJyjQ865DfMEl4DblO2icqFdRPUfqGrlnShyFn Aj/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=oPeXV/dOojEamyyF6jUq6V140THA+8effk7BngeCmok=; fh=l8kFeWCHQiow7EIyoMueDZy9I1Z5y9e7lwiVpthlwL8=; b=h5D0SkKtHtOTBA7hbsdUZldX7NydXJTHtmyN8NpEHmwfeJj/9ZLv+Rfkku8Z2aM/85 f4VByQY0SFqNbNJrgdvOjsYFPhOuSc27pNoYibjGDRnGIA9BtgswBF7ptdqOQNZN/ROa xYcWIQyjY+AKF9ILbchU3+2nrwgX2Gztv2PxgmzifULK4WHD1HSyUMKCNgP0K4TfVHmb wOgXrKJMwixR+mJi1/ObYtNCG3c1C4PXcpGqFrY0irahUpYGLDkVpt1Oemx9DwNyLFVA xpqQ8mJBZ/q7E5RJGL78f6yFrP2NA2gRFj4gI/7zqmdv8jfXiihAhdgsemuB3mg1OncP stCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id lp15-20020a17090b4a8f00b002634977e6e5si6322203pjb.142.2023.09.22.02.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 02:51:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E6B3A82251DC; Fri, 22 Sep 2023 02:38:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233168AbjIVJiF (ORCPT + 99 others); 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 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:38:10 -0700 (PDT) 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