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 62F1CC433EF for ; Fri, 25 Feb 2022 14:38:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0ECD8D0003; Fri, 25 Feb 2022 09:38:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DBE278D0001; Fri, 25 Feb 2022 09:38:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C86968D0003; Fri, 25 Feb 2022 09:38:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id B53078D0001 for ; Fri, 25 Feb 2022 09:38:47 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 748191814BA20 for ; Fri, 25 Feb 2022 14:38:47 +0000 (UTC) X-FDA: 79181558694.25.994AFFC Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf23.hostedemail.com (Postfix) with ESMTP id D1CCB14000C for ; Fri, 25 Feb 2022 14:38:46 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21DCCB830B5; Fri, 25 Feb 2022 14:38:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21D44C340E7; Fri, 25 Feb 2022 14:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645799923; bh=NPDWNX4z15E/nqAD2vGd2TQeDDWREovDKjiNWAiQWYI=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=LLFcRuCqAx0Ofpr1UyhOV9cVmRpmEYfshwPkdi7vYBN4BpX5xl3IPqDVsga3LHPcL yviGcRxmJEtO3joHSepSfmGTd6eUAAK9mWFMw/HXA8ypbeUfySxWQeo3OMO4uY90TC 40asBPPg/Npk5RJI1PRFGI/utCx0Tl3znNYEfozp1/8NxSlpHXe8n9iImgG++sEaUY jDUaCnumZvyf4M0zH4CmE2dDIcRF1+KzXoHySpZWWeTZ9q4CKPJqEcIe/mz8KhA8kV N0Vx/NbOuXHsZaLsmt2lpbrMFvFwxP8Ro2sShP3875LE4dGnF6UxL9vWIymLS3Zp7q wtvWT/sj9f2Ag== Message-ID: <153130cc-e8d2-e65a-ff83-0a5ed243cc1c@kernel.org> Date: Fri, 25 Feb 2022 08:38:41 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 25/30] nios2/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT Content-Language: en-US From: Dinh Nguyen To: Anshuman Khandual , 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> In-Reply-To: <7043506b-ad04-4572-316c-c5498873b8b1@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LLFcRuCq; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of dinguyen@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=dinguyen@kernel.org X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D1CCB14000C X-Stat-Signature: xwyb5mir6eyza4h1y64m4ut6nixir8z1 X-HE-Tag: 1645799926-633446 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 08:29, Dinh Nguyen wrote: >=20 >=20 > 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=20 >>>> vm_get_page_prot() via >>>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. Subsequently all __SXXX and=20 >>>> __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=20 >>>> ++++++++++++++++++++++++++++++++ >>>> =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_CP= U >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_HAS_SYNC_DMA_FOR_DE= VICE >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select ARCH_HAS_DMA_SET_UNCACHE= D >>>> +=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=20 >>>> 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 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 /* = 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_CACH= ED |=20 >>>> _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_struct= =20 >>>> *vma) >>>> =C2=A0=C2=A0 { >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (vma->vm_start =3D=3D KU= SER_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_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); >>> >>> I'm getting this compile error after applying this patch when build=20 >>> NIOS2: >> >> Hmm, that is strange. >> >> Did you apply the entire series or atleast upto the nios2 patch ? Gene= ric >> vm_get_page_prot() should not be called (which is build complaining he= re) >> 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 up= to >> this particular patch, build was successful. >> >=20 > Ok, I did not apply the whole series, just this patch. >=20 Is someone taking this whole series or should I just take this patch? Dinh