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 9C286C433EF for ; Fri, 25 Feb 2022 08:52:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 228FD8D0002; Fri, 25 Feb 2022 03:52:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DA0B8D0001; Fri, 25 Feb 2022 03:52:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0EED58D0002; Fri, 25 Feb 2022 03:52:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id F3CA18D0001 for ; Fri, 25 Feb 2022 03:52:11 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AFD74181D7EAE for ; Fri, 25 Feb 2022 08:52:11 +0000 (UTC) X-FDA: 79180685262.27.FF9278B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf18.hostedemail.com (Postfix) with ESMTP id 9D2CA1C0008 for ; Fri, 25 Feb 2022 08:52:09 +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 B0320106F; Fri, 25 Feb 2022 00:52:08 -0800 (PST) Received: from [10.163.51.16] (unknown [10.163.51.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 855243F70D; Fri, 25 Feb 2022 00:52:06 -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> From: Anshuman Khandual Message-ID: <637cfc45-60ad-3cd1-5127-76ecabb87def@arm.com> Date: Fri, 25 Feb 2022 14:22:03 +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: <50ac6dc2-7c71-2a8b-aa00-78926351b252@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Queue-Id: 9D2CA1C0008 X-Stat-Signature: d17rcfrtnp3wu1mux577zu1d5nt8puog X-Rspam-User: Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam05 X-HE-Tag: 1645779129-439096 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 7:01 AM, Dinh Nguyen wrote: > Hi Anshuman, >=20 > On 2/13/22 20:30, Anshuman Khandual wrote: >> This defines and exports a platform specific custom vm_get_page_prot()= via >> subscribing ARCH_HAS_VM_GET_PAGE_PROT. Subsequently all __SXXX and __P= XXX >> 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 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 arch/nios2/include/asm/pgtable.h | 16 ------------ >> =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 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 select ARCH_HAS_SYNC_DMA_FOR_CPU >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_HAS_SYNC_DMA_FOR_DEVICE >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_HAS_DMA_SET_UNCACHED >> +=C2=A0=C2=A0=C2=A0 select ARCH_HAS_VM_GET_PAGE_PROT >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_NO_SWAP >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select COMMON_CLK >> =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 /* Remove W bit on private pages for COW support */ >> -#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 /* CO= W */ >> -#define __P011=C2=A0=C2=A0=C2=A0 MKP(0, 0, 1)=C2=A0=C2=A0=C2=A0 /* CO= W */ >> -#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 /* CO= W */ >> -#define __P111=C2=A0=C2=A0=C2=A0 MKP(1, 0, 1)=C2=A0=C2=A0=C2=A0 /* CO= W */ >> =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 /* Used all over the kernel */ >> =C2=A0 #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHED | _PA= GE_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_struct *= vma) >> =C2=A0 { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (vma->vm_start =3D=3D KUSER_BASE= ) ? "[kuser]" : NULL; >> =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_EXEC |= 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); >=20 > I'm getting this compile error after applying this patch when build NIO= S2: Hmm, that is strange. Did you apply the entire series or atleast upto the nios2 patch ? Generic vm_get_page_prot() should not be called (which is build complaining here) 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 upto this particular patch, build was successful. >=20 >=20 > mm/mmap.c:105:2: error: =E2=80=98__P000=E2=80=99 undeclared here (not i= n a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 ^~~~~~ >=20 > mm/mmap.c:105:10: error: =E2=80=98__P001=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =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 ^~~~~~ >=20 > mm/mmap.c:105:18: error: =E2=80=98__P010=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~ >=20 > =C2=A0 AR=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fs/devpts/built-in.a >=20 > mm/mmap.c:105:26: error: =E2=80=98__P011=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =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=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 ^~~~~~ >=20 > mm/mmap.c:105:34: error: =E2=80=98__P100=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =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=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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ^~~~~~ >=20 > mm/mmap.c:105:42: error: =E2=80=98__P101=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =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=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=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=C2=A0 ^~~~~~ >=20 > mm/mmap.c:105:50: error: =E2=80=98__P110=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =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=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=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=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~ >=20 > mm/mmap.c:105:58: error: =E2=80=98__P111=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 105 |=C2=A0 __P000, __P001, __P010, __P011, __P100, __P101, __P1= 10, __P111, >=20 > =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=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=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=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=C2=A0=C2= =A0 ^~~~~~ >=20 > mm/mmap.c:106:2: error: =E2=80=98__S000=E2=80=99 undeclared here (not i= n a function) >=20 > =C2=A0 106 |=C2=A0 __S000, __S001, __S010, __S011, __S100, __S101, __S1= 10, __S111 >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 ^~~~~~ >=20 > mm/mmap.c:106:10: error: =E2=80=98__S001=E2=80=99 undeclared here (not = in a function) >=20 > =C2=A0 106 |=C2=A0 __S000, __S001, __S010, __S011, __S100, __S101, __S1= 10, __S111 >=20 >=20 >=20 > Dinh >=20