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 5E022CD4F47 for ; Fri, 22 Sep 2023 09:38:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE3DE6B02AD; Fri, 22 Sep 2023 05:38:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E93806B02AE; Fri, 22 Sep 2023 05:38:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D82356B02AF; Fri, 22 Sep 2023 05:38:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C7EB46B02AD for ; Fri, 22 Sep 2023 05:38:00 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A8522B3868 for ; Fri, 22 Sep 2023 09:38:00 +0000 (UTC) X-FDA: 81263731920.16.1006613 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id DC80A40003 for ; Fri, 22 Sep 2023 09:37:58 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695375479; a=rsa-sha256; cv=none; b=SUrLVnyU6350Qk66gAfczJTaqdNklakM199viTlWJNtLYCbHSKikSSWFHmbfren991hUQd tVQBN1QgCavJEKNqr4LFc7DV/sIe2n3eKJEFgu0Efl/LBSB/tsb/xwOH+o+doI7V8IG/oX qWeQqiJvyqeXKumhcvvIw5q20lm2SLw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695375479; 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=oPeXV/dOojEamyyF6jUq6V140THA+8effk7BngeCmok=; b=L7mFX7l+8mQj/P5GpvdPgR7+SPFnXZQtfsIjH+JcSK9b8FVwsP/L4XmrBJkKQbWkcfV9BW PwADdLOUl6P+qZx8DeCd8cNeN9UxIZp89KkgsLF9J++PShWF3OuwvArPWttpu3Etf83NBq 2WV9z5XQYi1Dlnjct4bPLFQhK2eB9D4= 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-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DC80A40003 X-Stat-Signature: bbwcnfrakik5bedcu5u38bdfonm91qm4 X-Rspam-User: X-HE-Tag: 1695375478-616314 X-HE-Meta: U2FsdGVkX1/uvR6TXwGEYAlLWf8Jo351VOLv7IZxoafJ+xGzgmjnUPXgNCwCl8DaHg5ieS51VLf5m2/rmi2RG7lWUcmqXyA8YErtgbi5Z6bU6FXiLmS+HE98KTSvlxdfwuzIC51717Oh6Phfv6eNLAvSZmJ2wa+OB1Pp2KXy09VZPH9wloyfZLMy6SscrMImXxm1O8lts9rbXJk4oepDVT4mA8TLKeT+gxfujry+JaWaDtYvaoDjB6aOhNyaqGIFld2nnzLv2Us9X9k9IVP9tURRFwkdXWMcxhL8WOm2MWJC/b+wi0IuKRBsYcsFt2omCIiD+ryiOVRNeshgWofd4Rkq1NYcqWFGL+RWRjMktrCQ8hPhabkrDkEXLsavo5diKRdmFwRzgH7T4LnS7f1Ot5Qt5cvD5grmPRlKsjB4e6pZppd2uyKTCxDh+TpeDE8gMyamkquDtpehp9o4In6RksxOh2z7dTbz9l5KUXtEMUtJTvS+rId/gEm7LZkG/olqm50SXbwAGFImubtWuFCS3PAxH6XqlsTLE3q8QtBhKT6kjELPJ7i+oVC94TMhnYIZt6OFGxYcGcm2jrAmW3VR+df6KN2bobDDDJstvD9eTglNL1Z08zIlV1QCioUKjnh0b+gA5WcXUPhRmxCpnzodmNosb36lsDN1gEU/ED7QLv5oQC+cYyQLs4dglUCvKz84cHxBBq3sb0aGluu1VGs4xVbeAaoDo8WLCg2mbCUCctFj714bczx71KfJ2KkGxz599blOcJtXxwYcCK0Udgsa3XRGH10Frol/I/zIukpFR2W02+AV3qb497dF+df+9nwNCc6x8Vy3B+6BI+V15ict3i6ZjsYfg51yI7sMge3fRLZjIqDrK//aBILjl3pAQ/FTXSZZJLVjX9Tcxs7GxYcPXZgffxS+M2ROM/8Wc1oFFAC77YFiNHQ1ug+3m5DCa0oYrsEhJlrHu704TQKK12s 42GJgyQV I9TPHU6oPWtvNqdtsQxjSD34UyVRLpK8HoAGUjyi3XVFZPI+l8XibzE/4MveH5jsEIaGiWyWr9J9haE0kZ7SSXcaoThoHZ+YnZVfxNbu+dsYJDLtXp8xw5+v5UzYHxxcHT3Ty5cjLvmp1V9ElezxXMQz9sD5RvVHE3nGhtwT9RrKU5AYX1+zfUdn7Q9bvTAIFzttHGs6i+TNbUdCMLLcvRPuNfMAS8F3abDIUGhgDSxJ4Xoc= 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: 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