[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YVKdH4G5Alfwjkix@infradead.org>
Date: Tue, 28 Sep 2021 05:42:07 +0100
From: Christoph Hellwig <hch@...radead.org>
To: Anshuman Khandual <anshuman.khandual@....com>
Cc: Christoph Hellwig <hch@...radead.org>, linux-mm@...ck.org,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
"David S. Miller" <davem@...emloft.net>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-mips@...r.kernel.org, sparclinux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/mmap: Define index macros for protection_map[]
On Tue, Sep 28, 2021 at 08:24:43AM +0530, Anshuman Khandual wrote:
> > simple switch statement provided by each architecture. See the below
> > WIP which just works for x86 and without pagetable debugging for where I
> > think we should be going.
>
> Sure, this will work as well but all platforms need to be changed at once.
> Is there any platform that would not subscribe ARCH_HAS_GET_PAGE_PROT and
> export its own vm_get_page_prot() ? AFAICS all platforms are required to
> export __PXXX and __SXXX elements currently.
>
> This seems to be a better idea than the current proposal. Probably all the
> vm_flags combinations, which will be used in those switch statements can be
> converted into macros just to improve readability. Are you planning to send
> this as a proper patch soon ?
This was just a quŃ–ck WIP patch. If you have some spare time to tackle
it for real I'd sugget the following approach:
1) Remove the direct references to protection_map in debug_vm_pgtable.c
2) add the ARCH_HAS_GET_PAGE_PROT symbol that lets architectures
provide vm_get_page_prot itself and not define protection_map at all
in this case
3) convert all architectures that touch protection_map to provide
vm_get_page_prot themselves
4) mark protection_map static
5) convert all architectures that provide arch_filter_pgprot and/or
arch_vm_get_page_prot to provide vm_get_page_prot directly and
remove those hooks
6) remove the __S???/__P??? macros and the generic vm_get_page_prot
after providing an arch implementation for every architecture.
This can maybe simplified with a new generic version that directly
looks at PAGE_* macros, but that will need further investigation
first.
Powered by blists - more mailing lists