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 EE565C433EF for ; Mon, 28 Feb 2022 02:27:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D69498D0002; Sun, 27 Feb 2022 21:27:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF16B8D0001; Sun, 27 Feb 2022 21:27:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B92238D0002; Sun, 27 Feb 2022 21:27:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id A6BEA8D0001 for ; Sun, 27 Feb 2022 21:27:57 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4C40094FB7 for ; Mon, 28 Feb 2022 02:27:57 +0000 (UTC) X-FDA: 79190603394.31.3F77922 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP id 72251A0002 for ; Mon, 28 Feb 2022 02:27:56 +0000 (UTC) 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 70952D6E; Sun, 27 Feb 2022 18:27:55 -0800 (PST) Received: from [10.163.47.185] (unknown [10.163.47.185]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E4803F73D; Sun, 27 Feb 2022 18:27:53 -0800 (PST) Subject: Re: [PATCH 25/30] nios2/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT To: Dinh Nguyen , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Christoph Hellwig , Andrew Morton , linux-arch@vger.kernel.org References: <1644805853-21338-1-git-send-email-anshuman.khandual@arm.com> <1644805853-21338-26-git-send-email-anshuman.khandual@arm.com> <50ac6dc2-7c71-2a8b-aa00-78926351b252@kernel.org> <637cfc45-60ad-3cd1-5127-76ecabb87def@arm.com> <7043506b-ad04-4572-316c-c5498873b8b1@kernel.org> <153130cc-e8d2-e65a-ff83-0a5ed243cc1c@kernel.org> From: Anshuman Khandual Message-ID: Date: Mon, 28 Feb 2022 07:57:51 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <153130cc-e8d2-e65a-ff83-0a5ed243cc1c@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 72251A0002 X-Stat-Signature: y586wgk7jwszc3ka7wucdg69cju135gn Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf15.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-HE-Tag: 1646015276-443239 Content-Transfer-Encoding: quoted-printable 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 2/25/22 8:08 PM, Dinh Nguyen wrote: >=20 >=20 > On 2/25/22 08:29, Dinh Nguyen wrote: >> >> >> On 2/25/22 02:52, Anshuman Khandual wrote: >>> >>> >>> On 2/25/22 7:01 AM, Dinh Nguyen wrote: >>>> Hi Anshuman, >>>> >>>> On 2/13/22 20:30, Anshuman Khandual wrote: >>>>> This defines and exports a platform specific custom vm_get_page_pro= t() via >>>>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. Subsequently all __SXXX and = __PXXX >>>>> macros can be dropped which are no longer needed. >>>>> >>>>> Cc: Dinh Nguyen >>>>> Cc: linux-kernel@vger.kernel.org >>>>> Signed-off-by: Anshuman Khandual >>>>> Acked-by: Dinh Nguyen >>>>> --- >>>>> =C2=A0=C2=A0 arch/nios2/Kconfig=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + >>>>> =C2=A0=C2=A0 arch/nios2/include/asm/pgtable.h | 16 ------------ >>>>> =C2=A0=C2=A0 arch/nios2/mm/init.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 45 +++++++++++++++++++++++++++++++= + >>>>> =C2=A0=C2=A0 3 files changed, 46 insertions(+), 16 deletions(-) >>>>> >>>>> diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig >>>>> index 33fd06f5fa41..85a58a357a3b 100644 >>>>> --- a/arch/nios2/Kconfig >>>>> +++ b/arch/nios2/Kconfig >>>>> @@ -6,6 +6,7 @@ config NIOS2 >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_HAS_SYNC_DMA_FOR_C= PU >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_HAS_SYNC_DMA_FOR_D= EVICE >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_HAS_DMA_SET_UNCACH= ED >>>>> +=C2=A0=C2=A0=C2=A0 select ARCH_HAS_VM_GET_PAGE_PROT >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_NO_SWAP >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select COMMON_CLK >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select TIMER_OF >>>>> diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/= asm/pgtable.h >>>>> index 4a995fa628ee..2678dad58a63 100644 >>>>> --- a/arch/nios2/include/asm/pgtable.h >>>>> +++ b/arch/nios2/include/asm/pgtable.h >>>>> @@ -40,24 +40,8 @@ struct mm_struct; >>>>> =C2=A0=C2=A0=C2=A0 */ >>>>> =C2=A0=C2=A0 =C2=A0 /* Remove W bit on private pages for COW suppor= t */ >>>>> -#define __P000=C2=A0=C2=A0=C2=A0 MKP(0, 0, 0) >>>>> -#define __P001=C2=A0=C2=A0=C2=A0 MKP(0, 0, 1) >>>>> -#define __P010=C2=A0=C2=A0=C2=A0 MKP(0, 0, 0)=C2=A0=C2=A0=C2=A0 /*= COW */ >>>>> -#define __P011=C2=A0=C2=A0=C2=A0 MKP(0, 0, 1)=C2=A0=C2=A0=C2=A0 /*= COW */ >>>>> -#define __P100=C2=A0=C2=A0=C2=A0 MKP(1, 0, 0) >>>>> -#define __P101=C2=A0=C2=A0=C2=A0 MKP(1, 0, 1) >>>>> -#define __P110=C2=A0=C2=A0=C2=A0 MKP(1, 0, 0)=C2=A0=C2=A0=C2=A0 /*= COW */ >>>>> -#define __P111=C2=A0=C2=A0=C2=A0 MKP(1, 0, 1)=C2=A0=C2=A0=C2=A0 /*= COW */ >>>>> =C2=A0=C2=A0 =C2=A0 /* Shared pages can have exact HW mapping */ >>>>> -#define __S000=C2=A0=C2=A0=C2=A0 MKP(0, 0, 0) >>>>> -#define __S001=C2=A0=C2=A0=C2=A0 MKP(0, 0, 1) >>>>> -#define __S010=C2=A0=C2=A0=C2=A0 MKP(0, 1, 0) >>>>> -#define __S011=C2=A0=C2=A0=C2=A0 MKP(0, 1, 1) >>>>> -#define __S100=C2=A0=C2=A0=C2=A0 MKP(1, 0, 0) >>>>> -#define __S101=C2=A0=C2=A0=C2=A0 MKP(1, 0, 1) >>>>> -#define __S110=C2=A0=C2=A0=C2=A0 MKP(1, 1, 0) >>>>> -#define __S111=C2=A0=C2=A0=C2=A0 MKP(1, 1, 1) >>>>> =C2=A0=C2=A0 =C2=A0 /* Used all over the kernel */ >>>>> =C2=A0=C2=A0 #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CAC= HED | _PAGE_READ | \ >>>>> diff --git a/arch/nios2/mm/init.c b/arch/nios2/mm/init.c >>>>> index 613fcaa5988a..311b2146a248 100644 >>>>> --- a/arch/nios2/mm/init.c >>>>> +++ b/arch/nios2/mm/init.c >>>>> @@ -124,3 +124,48 @@ const char *arch_vma_name(struct vm_area_struc= t *vma) >>>>> =C2=A0=C2=A0 { >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (vma->vm_start =3D=3D K= USER_BASE) ? "[kuser]" : NULL; >>>>> =C2=A0=C2=A0 } >>>>> + >>>>> +pgprot_t vm_get_page_prot(unsigned long vm_flags) >>>>> +{ >>>>> +=C2=A0=C2=A0=C2=A0 switch (vm_flags & (VM_READ | VM_WRITE | VM_EXE= C | VM_SHARED)) { >>>>> +=C2=A0=C2=A0=C2=A0 case VM_NONE: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 0, 0); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 0, 1); >>>>> +=C2=A0=C2=A0=C2=A0 /* COW */ >>>>> +=C2=A0=C2=A0=C2=A0 case VM_WRITE: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 0, 0); >>>>> +=C2=A0=C2=A0=C2=A0 /* COW */ >>>>> +=C2=A0=C2=A0=C2=A0 case VM_WRITE | VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 0, 1); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_EXEC: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 0, 0); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_EXEC | VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 0, 1); >>>>> +=C2=A0=C2=A0=C2=A0 /* COW */ >>>>> +=C2=A0=C2=A0=C2=A0 case VM_EXEC | VM_WRITE: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 0, 0); >>>>> +=C2=A0=C2=A0=C2=A0 /* COW */ >>>>> +=C2=A0=C2=A0=C2=A0 case VM_EXEC | VM_WRITE | VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 0, 1); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 0, 0); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED | VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 0, 1); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED | VM_WRITE: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 1, 0); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED | VM_WRITE | VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(0, 1, 1); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED | VM_EXEC: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 0, 0); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED | VM_EXEC | VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 0, 1); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED | VM_EXEC | VM_WRITE: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 1, 0); >>>>> +=C2=A0=C2=A0=C2=A0 case VM_SHARED | VM_EXEC | VM_WRITE | VM_READ: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return MKP(1, 1, 1); >>>>> +=C2=A0=C2=A0=C2=A0 default: >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 BUILD_BUG(); >>>>> +=C2=A0=C2=A0=C2=A0 } >>>>> +} >>>>> +EXPORT_SYMBOL(vm_get_page_prot); >>>> >>>> I'm getting this compile error after applying this patch when build = NIOS2: >>> >>> Hmm, that is strange. >>> >>> Did you apply the entire series or atleast upto the nios2 patch ? Gen= eric >>> vm_get_page_prot() should not be called (which is build complaining h= ere) >>> when ARCH_HAS_VM_GET_PAGE_PROT is already enabled on nios2 platform. >>> >>> Ran a quick build test on nios2 for the entire series and also just u= pto >>> this particular patch, build was successful. >>> >> >> Ok, I did not apply the whole series, just this patch. >> >=20 >=20 > Is someone taking this whole series or should I just take this patch? I expect the series (latest instead) will go via the mm tree, but will really appreciate your tags if you find the series acceptable.